Skip to content

Commit 4a6ee69

Browse files
committed
fix(task): forward new_task thinking_effort through native tool-call parsing
1 parent 4eb13a9 commit 4a6ee69

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

‎src/core/assistant-message/NativeToolCallParser.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,9 @@ export class NativeToolCallParser {
633633
mode: partialArgs.mode,
634634
message: partialArgs.message,
635635
todos: partialArgs.todos,
636+
// DTE series 5/5: optional subtask start effort must reach execute()
637+
// for capability validation (dropping it made the arg a silent no-op).
638+
thinking_effort: partialArgs.thinking_effort,
636639
}
637640
}
638641
break
@@ -988,6 +991,9 @@ export class NativeToolCallParser {
988991
mode: args.mode,
989992
message: args.message,
990993
todos: args.todos,
994+
// DTE series 5/5: optional subtask start effort must reach execute()
995+
// for capability validation (dropping it made the arg a silent no-op).
996+
thinking_effort: args.thinking_effort,
991997
} as NativeArgsFor<TName>
992998
}
993999
break

‎src/core/assistant-message/__tests__/NativeToolCallParser.spec.ts‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,57 @@ describe("NativeToolCallParser", () => {
291291
})
292292
})
293293
})
294+
describe("new_task tool", () => {
295+
it("should carry the optional thinking_effort argument into nativeArgs (DTE series 5/5)", () => {
296+
const toolCall = {
297+
id: "toolu_new_task_effort",
298+
name: "new_task" as const,
299+
arguments: JSON.stringify({
300+
mode: "ask",
301+
message: "Complete the delegated subtask",
302+
todos: "- [ ] step one",
303+
thinking_effort: "high",
304+
}),
305+
}
306+
307+
const result = NativeToolCallParser.parseToolCall(toolCall)
308+
309+
expect(result).not.toBeNull()
310+
expect(result?.type).toBe("tool_use")
311+
if (result?.type === "tool_use") {
312+
const nativeArgs = result.nativeArgs as {
313+
mode: string
314+
message: string
315+
todos?: string
316+
thinking_effort?: string
317+
}
318+
expect(nativeArgs.mode).toBe("ask")
319+
expect(nativeArgs.message).toBe("Complete the delegated subtask")
320+
expect(nativeArgs.todos).toBe("- [ ] step one")
321+
expect(nativeArgs.thinking_effort).toBe("high")
322+
}
323+
})
324+
325+
it("should leave nativeArgs.thinking_effort undefined when the argument is omitted", () => {
326+
const toolCall = {
327+
id: "toolu_new_task_no_effort",
328+
name: "new_task" as const,
329+
arguments: JSON.stringify({
330+
mode: "ask",
331+
message: "Complete the delegated subtask",
332+
}),
333+
}
334+
335+
const result = NativeToolCallParser.parseToolCall(toolCall)
336+
337+
expect(result).not.toBeNull()
338+
expect(result?.type).toBe("tool_use")
339+
if (result?.type === "tool_use") {
340+
const nativeArgs = result.nativeArgs as { thinking_effort?: string }
341+
expect(nativeArgs.thinking_effort).toBeUndefined()
342+
}
343+
})
344+
})
294345
})
295346

296347
describe("processStreamingChunk", () => {

0 commit comments

Comments
 (0)