Skip to content

Commit 0902687

Browse files
committed
Merge branch 'feat/dte-5-orchestrator' of https://github.com/easonLiangWorldedtech/Zoo-Code into feat/dte-trial-all
2 parents c8109bc + 6eba686 commit 0902687

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

src/core/tools/NewTaskTool.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,16 @@ export class NewTaskTool extends BaseTool<"new_task"> {
7676
const modelCapabilities = task.api.getModel().info.supportsReasoningEffort
7777
// "disable" stays in the element type: capability arrays may carry it (it is a
7878
// settings off-switch, not a start level) and is filtered where levels are listed.
79+
// Registry capability arrays are never trusted blindly — normalize to the known
80+
// level set so an unknown string cannot reach the ask payload or the child effort.
7981
const supportedLevels: readonly (ReasoningEffortExtended | "disable")[] =
8082
modelCapabilities === true
8183
? NEW_TASK_EFFORT_LEVELS
8284
: Array.isArray(modelCapabilities)
83-
? modelCapabilities
85+
? modelCapabilities.filter(
86+
(level): level is ReasoningEffortExtended | "disable" =>
87+
level === "disable" || isNewTaskEffortLevel(level),
88+
)
8489
: []
8590
// "disable" is a settings off-switch, never a start level: filtering it can
8691
// leave an empty list (a model whose only capability is "disable"). In that

src/core/tools/__tests__/newTaskThinkingEffort.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,44 @@ describe("new_task thinking_effort validation (DTE series 5/5)", () => {
279279
expect(delegateParentAndOpenChild).not.toHaveBeenCalled()
280280
})
281281

282+
it("filters unknown capability strings out of the supported levels (DTE series 5/5)", async () => {
283+
const { task } = makeTask({
284+
supportsReasoningEffort: ["turbo", "low", "disable"],
285+
askEffort: "low",
286+
})
287+
const callbacks = makeCallbacks()
288+
289+
await runNewTask(task, { thinking_effort: "low" }, callbacks)
290+
291+
// Registry data is normalized to the known level set: the unknown "turbo"
292+
// and the settings off-switch "disable" never reach the ask payload.
293+
expect(callbacks.askApproval).toHaveBeenCalledTimes(1)
294+
const [askType, toolMessage] = vi.mocked(callbacks.askApproval).mock.calls[0]
295+
expect(askType).toBe("tool")
296+
const payload = JSON.parse(toolMessage as string) as {
297+
tool: string
298+
supportedThinkingEfforts?: string[]
299+
}
300+
expect(payload.tool).toBe("newTask")
301+
expect(payload.supportedThinkingEfforts).toEqual(["low"])
302+
})
303+
304+
it("treats a capability array of only unknown values as unsupported (DTE series 5/5)", async () => {
305+
const { task, delegateParentAndOpenChild } = makeTask({
306+
supportsReasoningEffort: ["turbo"],
307+
})
308+
const callbacks = makeCallbacks()
309+
310+
await runNewTask(task, { thinking_effort: "low" }, callbacks)
311+
312+
// Normalization drops the unknown value, leaving no start level: the
313+
// unsupported-model wording is the accurate hint.
314+
expect(callbacks.pushToolResult).toHaveBeenCalledWith(
315+
expect.stringContaining("does not support thinking_effort"),
316+
)
317+
expect(delegateParentAndOpenChild).not.toHaveBeenCalled()
318+
})
319+
282320
it("pre-fills the ask payload with the effort and the supported levels, filtering 'disable'", async () => {
283321
const { task } = makeTask({
284322
supportsReasoningEffort: ["disable", "low", "medium"],

0 commit comments

Comments
 (0)