Repository navigation
Commit 2da6ea2
fix: streaming tool-call argument loss in NativeToolCallParser (Zoo-Code-Org#695) (Zoo-Code-Org#700)
* fix: streaming tool-call argument loss in NativeToolCallParser (Zoo-Code-Org#695)
* chore: remove agent-generated changeset file per policy
* test: add direct coverage for finalizeRawChunks() in NativeToolCallParser
* fix: address PR Zoo-Code-Org#700 review feedback for tool-call streaming reassembly
- Guard finalize results with not.toBeNull() in parallel-index and single-chunk tests so a null result fails instead of passing silently
- Add reverse-ordering test (name -> buffered args -> id) covering the start-gate id requirement
- Use name !== undefined recording plus a nameSeen flag in the start-gate as a defensive guard against an empty tool name
- Clear rawChunkTracker in processFinishReason so finalizeRawChunks is a safe no-op; add a regression test asserting no double tool_call_end
- Remove unrelated ask_followup_question wording change from PR scope
- Remove prs/fix-toolcall-dropped-leading-deltas.md from the diff
* fix: handle provider-emitted tool_call_end chunks during streaming
Task.ts had no stream-level case for tool_call_end, so end chunks emitted
by providers on finish_reason: "tool_calls" were silently dropped; tool
calls only finalized at stream end via finalizeRawChunks(). Add a
tool_call_end case so tools finalize and present during streaming, and
extract the triplicated finalize/present logic into a shared idempotent
helper. Correct the NativeToolCallParser test drive helper to finalize via
finalizeRawChunks() (matching production) instead of processFinishReason().
* test: cover Task.finalizeStreamingToolCallById streaming finalization
Add a focused spec that invokes the real Task.prototype.finalizeStreamingToolCallById
via .call() with mocked presentAssistantMessage and NativeToolCallParser, covering
the success, null-finalize (malformed JSON), untracked-id no-op, and idempotent
re-finalize paths. Closes the codecov/patch gap on the new helper.
* test: adapt tool-call streaming coverage to scoped parser state
* test: type finalizeStreamingToolCallById fixtures as FinalizeStub
* fix(task): defer finalized tool execution until history persists
* refactor(parser): cut PR Zoo-Code-Org#700 to parser-only streaming scope
Restore Task.ts persistence coordination and stream-time tool_call_end finalization to main; retain only the Zoo-Code-Org#695 parser fixes with their focused tests.
---------
Co-authored-by: Elliott de Launay <[email protected]>1 parent e277ab9 commit 2da6ea2
2 files changed
Lines changed: 351 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
65 | 75 | | |
66 | 76 | | |
67 | 77 | | |
| |||
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
127 | | - | |
128 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
129 | 141 | | |
130 | 142 | | |
131 | 143 | | |
| 144 | + | |
132 | 145 | | |
133 | 146 | | |
134 | 147 | | |
135 | 148 | | |
136 | 149 | | |
137 | 150 | | |
138 | | - | |
139 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
140 | 154 | | |
141 | | - | |
142 | | - | |
143 | | - | |
| 155 | + | |
144 | 156 | | |
| 157 | + | |
145 | 158 | | |
146 | 159 | | |
147 | | - | |
148 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
149 | 164 | | |
150 | 165 | | |
151 | | - | |
| 166 | + | |
152 | 167 | | |
153 | 168 | | |
154 | 169 | | |
155 | 170 | | |
156 | | - | |
| 171 | + | |
157 | 172 | | |
158 | 173 | | |
159 | 174 | | |
160 | | - | |
| 175 | + | |
161 | 176 | | |
162 | 177 | | |
163 | 178 | | |
164 | 179 | | |
165 | 180 | | |
166 | 181 | | |
167 | | - | |
| 182 | + | |
168 | 183 | | |
169 | | - | |
| 184 | + | |
170 | 185 | | |
171 | 186 | | |
172 | 187 | | |
| |||
190 | 205 | | |
191 | 206 | | |
192 | 207 | | |
193 | | - | |
| 208 | + | |
194 | 209 | | |
195 | 210 | | |
196 | 211 | | |
| |||
0 commit comments