Skip to content

Commit 471490b

Browse files
committed
Merge branch 'feat/dte-5-orchestrator' into feat/dte-5-e2e
2 parents 4f88bce + 3ea9f63 commit 471490b

3 files changed

Lines changed: 48 additions & 13 deletions

File tree

‎src/__tests__/provider-delegation.spec.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@ describe("ClineProvider.delegateParentAndOpenChild()", () => {
537537
const taskHistoryStore = makeStoreStub()
538538
const providerLog = vi.fn()
539539

540+
// Partial provider double: the real ClineProvider.prototype.delegateParentAndOpenChild
541+
// is invoked below via .call() with only the members that method reads, so the full
542+
// interface is not implemented and the double assertion is the last-resort hand-off.
540543
const provider = {
541544
taskScheduler: new TaskScheduler(),
542545
emit: vi.fn(),
@@ -563,9 +566,19 @@ describe("ClineProvider.delegateParentAndOpenChild()", () => {
563566
// The say rejection is surfaced through the provider log, not thrown.
564567
expect(providerLog).toHaveBeenCalledWith(expect.stringContaining("non-fatal"))
565568
expect(providerLog).toHaveBeenCalledWith(expect.stringContaining("task disposed"))
566-
// Delegation metadata is still persisted for the (already disposed) parent.
569+
// Delegation metadata is still persisted for the (already disposed) parent:
570+
// capture the updater's resulting item and assert the delegated status and both
571+
// child links, not just that the metadata transaction was entered.
567572
expect(taskHistoryStore.atomicReadAndUpdate).toHaveBeenCalledTimes(1)
568-
expect(taskHistoryStore.atomicReadAndUpdate.mock.calls[0][0]).toBe("parent-1")
573+
const [calledTaskId, updater] = taskHistoryStore.atomicReadAndUpdate.mock.calls[0]
574+
expect(calledTaskId).toBe("parent-1")
575+
expect(updater(parentHistoryItem)).toMatchObject({
576+
id: "parent-1",
577+
status: "delegated",
578+
delegatedToId: "child-1",
579+
awaitingChildId: "child-1",
580+
childIds: expect.arrayContaining(["child-1"]),
581+
})
569582
// And the child is still scheduled despite the failed notification.
570583
expect(childRun).toHaveBeenCalledTimes(1)
571584
})

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,10 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
18121812
newTaskAskSupportedEfforts &&
18131813
newTaskAskSupportedEfforts.length > 0 && (
18141814
<select
1815-
aria-label="Thinking effort"
1815+
// DTE series 5/5: reuses the settings reasoning-effort labels, which are translated
1816+
// in every locale, so the accessible name and option labels are localized
1817+
// like the rest of the chat UI.
1818+
aria-label={t("settings:providers.reasoningEffort.label")}
18161819
// The prefill normalizes newTaskAskEffort to a supported level (see the
18171820
// newTask branch of the ask handler), so rendered and posted values agree.
18181821
value={newTaskAskEffort ?? newTaskAskSupportedEfforts[0]}
@@ -1834,7 +1837,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
18341837
}}>
18351838
{newTaskAskSupportedEfforts.map((effort) => (
18361839
<option key={effort} value={effort}>
1837-
{effort}
1840+
{t(`settings:providers.reasoningEffort.${effort}`)}
18381841
</option>
18391842
))}
18401843
</select>

‎webview-ui/src/components/chat/__tests__/ChatView.spec.tsx‎

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,19 +1561,30 @@ describe("ChatView - new_task thinking effort selector (DTE series 5/5)", () =>
15611561

15621562
await postToolAsk(NEW_TASK_ASK)
15631563

1564-
const select = await waitFor(() => getByLabelText("Thinking effort") as HTMLSelectElement)
1564+
const select = await waitFor(
1565+
() => getByLabelText("settings:providers.reasoningEffort.label") as HTMLSelectElement,
1566+
)
15651567
// Pre-filled with the effort the extension resolved for the new task...
15661568
expect(select).toHaveValue("low")
15671569
// ...and offers exactly the levels the target model supports.
15681570
expect(Array.from(select.options).map((option) => option.value)).toEqual(["low", "medium", "high"])
1571+
// Option labels are bound to the translated level keys (settings:providers.reasoningEffort.*);
1572+
// in this test the effective t() is the identity function, so the raw keys render verbatim.
1573+
expect(Array.from(select.options).map((option) => option.textContent)).toEqual([
1574+
"settings:providers.reasoningEffort.low",
1575+
"settings:providers.reasoningEffort.medium",
1576+
"settings:providers.reasoningEffort.high",
1577+
])
15691578
})
15701579

15711580
it("falls back to the first supported level when the pre-fill is not supported", async () => {
15721581
const { getByLabelText } = renderChatView()
15731582

15741583
await postToolAsk({ ...NEW_TASK_ASK, thinkingEffort: "xhigh", supportedThinkingEfforts: ["low", "high"] })
15751584

1576-
const select = await waitFor(() => getByLabelText("Thinking effort") as HTMLSelectElement)
1585+
const select = await waitFor(
1586+
() => getByLabelText("settings:providers.reasoningEffort.label") as HTMLSelectElement,
1587+
)
15771588
expect(select).toHaveValue("low")
15781589
})
15791590

@@ -1586,7 +1597,9 @@ describe("ChatView - new_task thinking effort selector (DTE series 5/5)", () =>
15861597
// not the raw payload value the user never saw.
15871598
await postToolAsk({ ...NEW_TASK_ASK, thinkingEffort: "xhigh", supportedThinkingEfforts: ["low", "high"] })
15881599

1589-
const select = await waitFor(() => getByLabelText("Thinking effort") as HTMLSelectElement)
1600+
const select = await waitFor(
1601+
() => getByLabelText("settings:providers.reasoningEffort.label") as HTMLSelectElement,
1602+
)
15901603
expect(select).toHaveValue("low")
15911604

15921605
await act(async () => {
@@ -1605,7 +1618,7 @@ describe("ChatView - new_task thinking effort selector (DTE series 5/5)", () =>
16051618

16061619
await postToolAsk(NEW_TASK_ASK)
16071620
await waitFor(() => {
1608-
expect(getByLabelText("Thinking effort")).toBeInTheDocument()
1621+
expect(getByLabelText("settings:providers.reasoningEffort.label")).toBeInTheDocument()
16091622
})
16101623

16111624
// A subsequent readFile ask must drop the selector: the effort state is
@@ -1618,7 +1631,7 @@ describe("ChatView - new_task thinking effort selector (DTE series 5/5)", () =>
16181631
})
16191632

16201633
await waitFor(() => {
1621-
expect(queryByLabelText("Thinking effort")).not.toBeInTheDocument()
1634+
expect(queryByLabelText("settings:providers.reasoningEffort.label")).not.toBeInTheDocument()
16221635
})
16231636
})
16241637

@@ -1631,14 +1644,16 @@ describe("ChatView - new_task thinking effort selector (DTE series 5/5)", () =>
16311644
await waitFor(() => {
16321645
expect(getByRole("button", { name: "chat:approve.title" })).toBeInTheDocument()
16331646
})
1634-
expect(queryByLabelText("Thinking effort")).not.toBeInTheDocument()
1647+
expect(queryByLabelText("settings:providers.reasoningEffort.label")).not.toBeInTheDocument()
16351648
})
16361649

16371650
it("posts the selected effort when the user approves the newTask ask", async () => {
16381651
const { getByLabelText, getByRole } = renderChatView()
16391652

16401653
await postToolAsk(NEW_TASK_ASK)
1641-
const select = await waitFor(() => getByLabelText("Thinking effort") as HTMLSelectElement)
1654+
const select = await waitFor(
1655+
() => getByLabelText("settings:providers.reasoningEffort.label") as HTMLSelectElement,
1656+
)
16421657

16431658
// The user switches the effort before entering the subtask...
16441659
await act(async () => {
@@ -1661,7 +1676,9 @@ describe("ChatView - new_task thinking effort selector (DTE series 5/5)", () =>
16611676
const { getByLabelText, getByRole, getByTestId } = renderChatView()
16621677

16631678
await postToolAsk(NEW_TASK_ASK)
1664-
const select = await waitFor(() => getByLabelText("Thinking effort") as HTMLSelectElement)
1679+
const select = await waitFor(
1680+
() => getByLabelText("settings:providers.reasoningEffort.label") as HTMLSelectElement,
1681+
)
16651682
await act(async () => {
16661683
fireEvent.change(select, { target: { value: "medium" } })
16671684
})
@@ -1704,7 +1721,9 @@ describe("ChatView - new_task thinking effort selector (DTE series 5/5)", () =>
17041721
const { getByLabelText, getByTestId } = renderChatView()
17051722

17061723
await postToolAsk(NEW_TASK_ASK)
1707-
const select = await waitFor(() => getByLabelText("Thinking effort") as HTMLSelectElement)
1724+
const select = await waitFor(
1725+
() => getByLabelText("settings:providers.reasoningEffort.label") as HTMLSelectElement,
1726+
)
17081727
await act(async () => {
17091728
fireEvent.change(select, { target: { value: "high" } })
17101729
})

0 commit comments

Comments
 (0)