Repository navigation
Commit 753c22f
easonLiangWorldedtech
fix(tools): report the captured stream failure on the parse-failure path
The unit captured streamError for exactly one reason - when the finalized block never
reaches execute(), the authoritative filesystem retry in execute() never happens, and the
captured error is the only failure the user can act on. Nothing read it: the hook released
the state but BaseTool still reported the incidental parse error, so the capture was dead
and the real failure was hidden behind a parse message.
clearTaskStreamState becomes releaseStreamStateOnParseFailure(task, callbacks): it releases
THIS task's state, restores the diff document the stream opened (revert before reset, as the
other teardowns do), and when a streamError was captured reports it with the same 'writing
file' context execute()'s catch uses, returning true so BaseTool suppresses the generic parse
error. The failure therefore surfaces exactly once. With no captured error the generic parse
error is still reported, and the default hook for other tools keeps returning false.
execute()'s early returns (missing path, missing content, rooignore denial) returned before
the success/catch cleanup, leaving the per-task state and its TaskAborted listener behind for
the task's lifetime - and a retained streamFailed suppresses the diff preview of every later
write_to_file in that task. They now release only this task's state.
Tests: 'reports the captured streaming failure once instead of the incidental parse error'
(handleError called once with the captured error, not with the parse error, state released,
revertChanges + reset ran) and 'releases the per-task stream state when execute() returns
early on a denied path'. Pins: returning false instead of reporting fails the first; removing
the release in the rooignore branch fails the second.
Local: core/tools + writeToFileTool.spec + assistant-message + core/task = 1420 passed / 5
skipped; tsc 0; eslint 0 err / 0 warn on all three files.1 parent 7752664 commit 753c22f
3 files changed
Lines changed: 102 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
107 | 121 | | |
108 | 122 | | |
109 | 123 | | |
| |||
164 | 178 | | |
165 | 179 | | |
166 | 180 | | |
167 | | - | |
168 | 181 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
174 | 189 | | |
175 | 190 | | |
176 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
| 163 | + | |
| 164 | + | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
176 | 175 | | |
177 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
178 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
179 | 195 | | |
180 | 196 | | |
181 | 197 | | |
| |||
197 | 213 | | |
198 | 214 | | |
199 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
200 | 220 | | |
201 | 221 | | |
202 | 222 | | |
| |||
205 | 225 | | |
206 | 226 | | |
207 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
208 | 232 | | |
209 | 233 | | |
210 | 234 | | |
| |||
214 | 238 | | |
215 | 239 | | |
216 | 240 | | |
| 241 | + | |
217 | 242 | | |
218 | 243 | | |
219 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
613 | 655 | | |
614 | 656 | | |
615 | 657 | | |
| |||
0 commit comments