Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 553b4da

Browse files
committed
feat: add Show subtask button when subtask is actively running
When a parent task has an active subtask (awaitingChildId is set), a "Show subtask" button now appears in the button bar area: - If no other action buttons are present, it shows as the primary button - If action buttons are already showing (e.g. resume_task), it appears as a secondary button alongside them This prevents users from missing that a subtask is running and accidentally interacting with the wrong task. Includes 4 new tests for the Show subtask button behavior.
1 parent 058ffc2 commit 553b4da

3 files changed

Lines changed: 430 additions & 51 deletions

File tree

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 101 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,8 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
15451545
vscode.postMessage({ type: "condenseTaskContextRequest", text: taskId })
15461546
}
15471547

1548-
const areButtonsVisible = showScrollToBottom || primaryButtonText || secondaryButtonText
1548+
const activeSubtaskId = currentTaskItem?.awaitingChildId
1549+
const areButtonsVisible = showScrollToBottom || primaryButtonText || secondaryButtonText || activeSubtaskId
15491550

15501551
return (
15511552
<div
@@ -1670,59 +1671,109 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
16701671
</>
16711672
) : (
16721673
<>
1673-
{primaryButtonText && (
1674-
<StandardTooltip
1675-
content={
1676-
primaryButtonText === t("chat:retry.title")
1677-
? t("chat:retry.tooltip")
1678-
: primaryButtonText === t("chat:save.title")
1679-
? t("chat:save.tooltip")
1680-
: primaryButtonText === t("chat:approve.title")
1681-
? t("chat:approve.tooltip")
1682-
: primaryButtonText === t("chat:runCommand.title")
1683-
? t("chat:runCommand.tooltip")
1684-
: primaryButtonText === t("chat:startNewTask.title")
1685-
? t("chat:startNewTask.tooltip")
1686-
: primaryButtonText === t("chat:resumeTask.title")
1687-
? t("chat:resumeTask.tooltip")
1688-
: primaryButtonText ===
1689-
t("chat:proceedAnyways.title")
1690-
? t("chat:proceedAnyways.tooltip")
1691-
: primaryButtonText ===
1692-
t("chat:proceedWhileRunning.title")
1693-
? t("chat:proceedWhileRunning.tooltip")
1694-
: undefined
1695-
}>
1674+
{activeSubtaskId && !primaryButtonText && !secondaryButtonText ? (
1675+
<StandardTooltip content={t("chat:subtasks.showActiveSubtaskTooltip")}>
16961676
<Button
16971677
variant="primary"
1698-
disabled={!enableButtons}
1699-
className={secondaryButtonText ? "flex-1 mr-[6px]" : "flex-[2] mr-0"}
1700-
onClick={() => handlePrimaryButtonClick(inputValue, selectedImages)}>
1701-
{primaryButtonText}
1702-
</Button>
1703-
</StandardTooltip>
1704-
)}
1705-
{secondaryButtonText && (
1706-
<StandardTooltip
1707-
content={
1708-
secondaryButtonText === t("chat:startNewTask.title")
1709-
? t("chat:startNewTask.tooltip")
1710-
: secondaryButtonText === t("chat:reject.title")
1711-
? t("chat:reject.tooltip")
1712-
: secondaryButtonText === t("chat:terminate.title")
1713-
? t("chat:terminate.tooltip")
1714-
: secondaryButtonText === t("chat:killCommand.title")
1715-
? t("chat:killCommand.tooltip")
1716-
: undefined
1717-
}>
1718-
<Button
1719-
variant="secondary"
1720-
disabled={!enableButtons}
1721-
className="flex-1 ml-[6px]"
1722-
onClick={() => handleSecondaryButtonClick(inputValue, selectedImages)}>
1723-
{secondaryButtonText}
1678+
data-testid="show-subtask-button"
1679+
className="flex-[2] mr-0"
1680+
onClick={() =>
1681+
vscode.postMessage({
1682+
type: "showTaskWithId",
1683+
text: activeSubtaskId,
1684+
})
1685+
}>
1686+
{t("chat:subtasks.showActiveSubtask")}
17241687
</Button>
17251688
</StandardTooltip>
1689+
) : (
1690+
<>
1691+
{primaryButtonText && (
1692+
<StandardTooltip
1693+
content={
1694+
primaryButtonText === t("chat:retry.title")
1695+
? t("chat:retry.tooltip")
1696+
: primaryButtonText === t("chat:save.title")
1697+
? t("chat:save.tooltip")
1698+
: primaryButtonText === t("chat:approve.title")
1699+
? t("chat:approve.tooltip")
1700+
: primaryButtonText === t("chat:runCommand.title")
1701+
? t("chat:runCommand.tooltip")
1702+
: primaryButtonText ===
1703+
t("chat:startNewTask.title")
1704+
? t("chat:startNewTask.tooltip")
1705+
: primaryButtonText ===
1706+
t("chat:resumeTask.title")
1707+
? t("chat:resumeTask.tooltip")
1708+
: primaryButtonText ===
1709+
t("chat:proceedAnyways.title")
1710+
? t("chat:proceedAnyways.tooltip")
1711+
: primaryButtonText ===
1712+
t(
1713+
"chat:proceedWhileRunning.title",
1714+
)
1715+
? t(
1716+
"chat:proceedWhileRunning.tooltip",
1717+
)
1718+
: undefined
1719+
}>
1720+
<Button
1721+
variant="primary"
1722+
disabled={!enableButtons}
1723+
className={
1724+
secondaryButtonText || activeSubtaskId
1725+
? "flex-1 mr-[6px]"
1726+
: "flex-[2] mr-0"
1727+
}
1728+
onClick={() =>
1729+
handlePrimaryButtonClick(inputValue, selectedImages)
1730+
}>
1731+
{primaryButtonText}
1732+
</Button>
1733+
</StandardTooltip>
1734+
)}
1735+
{activeSubtaskId && (
1736+
<StandardTooltip content={t("chat:subtasks.showActiveSubtaskTooltip")}>
1737+
<Button
1738+
variant="secondary"
1739+
data-testid="show-subtask-button"
1740+
className="flex-1 ml-[6px]"
1741+
onClick={() =>
1742+
vscode.postMessage({
1743+
type: "showTaskWithId",
1744+
text: activeSubtaskId,
1745+
})
1746+
}>
1747+
{t("chat:subtasks.showActiveSubtask")}
1748+
</Button>
1749+
</StandardTooltip>
1750+
)}
1751+
{secondaryButtonText && (
1752+
<StandardTooltip
1753+
content={
1754+
secondaryButtonText === t("chat:startNewTask.title")
1755+
? t("chat:startNewTask.tooltip")
1756+
: secondaryButtonText === t("chat:reject.title")
1757+
? t("chat:reject.tooltip")
1758+
: secondaryButtonText === t("chat:terminate.title")
1759+
? t("chat:terminate.tooltip")
1760+
: secondaryButtonText ===
1761+
t("chat:killCommand.title")
1762+
? t("chat:killCommand.tooltip")
1763+
: undefined
1764+
}>
1765+
<Button
1766+
variant="secondary"
1767+
disabled={!enableButtons}
1768+
className="flex-1 ml-[6px]"
1769+
onClick={() =>
1770+
handleSecondaryButtonClick(inputValue, selectedImages)
1771+
}>
1772+
{secondaryButtonText}
1773+
</Button>
1774+
</StandardTooltip>
1775+
)}
1776+
</>
17261777
)}
17271778
</>
17281779
)}

0 commit comments

Comments
 (0)