xonecas.io
64875
Mc

mini-coder / commit 0387112

fix(llm-api): extract reasoning delta correctly for gemini models

xonecas2026-03-12 03871124d211f70525671cc3c100c54c9f3121dc parent e26de00

3 files changed

TODO.md+0−2
@@ -1,7 +1,5 @@
11 # TODO
22
3-- Some errors from subagents are surfacing in the output, these mislead the user to think the subagent is stopped or broken, but most of the errors are recoverable or transient tool errors.
4-
53 ---
64
75 ## LSP Diagnostics (not very important, with tool-hooks and strong linting, this is not as necessary, but we should implement asap)
src/llm-api/turn.test.ts+9−0
@@ -54,6 +54,15 @@ describe("getReasoningDeltaFromStreamChunk", () => {
5454 ).toBe("legacy reasoning");
5555 });
5656
57+ test("reads SDK reasoning-delta delta field", () => {
58+ expect(
59+ getReasoningDeltaFromStreamChunk({
60+ type: "reasoning",
61+ delta: "new delta",
62+ }),
63+ ).toBe("new delta");
64+ });
65+
5766 test("returns null for non-reasoning chunks", () => {
5867 expect(
5968 getReasoningDeltaFromStreamChunk({ type: "text-delta", text: "hi" }),
src/llm-api/turn.ts+1−0
@@ -241,6 +241,7 @@ export function getReasoningDeltaFromStreamChunk(
241241 }
242242 if (typeof chunk.text === "string") return chunk.text;
243243 if (typeof chunk.textDelta === "string") return chunk.textDelta;
244+ if (typeof chunk.delta === "string") return chunk.delta;
244245 return "";
245246 }