Commit 95d8ed7
committed
revert(anthropic): drop the streamed tool-argument validation, keep the rest
Two attempts at making the streaming path agree with the non-stream path
about malformed tool arguments, both rejected by review for a real reason.
Stopping at the third rather than pushing another patch at the same spot.
Attempt one buffered `input_json_delta` fragments and validated at block
close. That broke the streaming contract: `src/bridge.ts:628` turns each
adapter delta into a client-visible
`response.function_call_arguments.delta` frame, and
`tests/responses-stream-tool-events.test.ts:30` pins that split fragments
stay split. A started call would show empty arguments until block close.
Attempt two kept fragments flowing and errored the turn when the assembled
JSON did not parse. Also wrong: the bridge's `error` case closes an open
tool call anyway (`src/bridge.ts:771`), emitting
`response.function_call_arguments.done` and an `output_item.done` with
`status:"completed"` BEFORE `response.failed`. The client is still told the
call completed.
The fix belongs in the bridge -- a terminal error mode that cancels rather
than closes an open tool call. That is out of scope for an Anthropic
adapter PR, affects every adapter's error path, and touches code whose
comment records that `JSON.parse("")` once poisoned whole sessions. It
deserves its own cycle with that history read first, not a third patch
from this end.
Kept, because both stand on their own: the non-stream `toolUseArguments`
degradation to `{}`, which fixes the half of #765 that is actually
fixable here, and the EOF stop-reason regression test that exposed the two
existing EOF tests as vacuous.
Reverted: every streaming-path change. That path now behaves exactly as it
did before this round, so nothing regressed -- the known defect is simply
still there, and #765 stays open for it.
Reasoning recorded in devlog/_plan/260731_pr_merge_round/021.1 parent 299cd2f commit 95d8ed7
3 files changed
Lines changed: 67 additions & 131 deletions
File tree
- devlog/_plan/260731_pr_merge_round
- src/adapters
- tests
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | 287 | | |
305 | 288 | | |
306 | 289 | | |
| |||
782 | 765 | | |
783 | 766 | | |
784 | 767 | | |
785 | | - | |
786 | 768 | | |
787 | 769 | | |
788 | 770 | | |
| |||
826 | 808 | | |
827 | 809 | | |
828 | 810 | | |
829 | | - | |
830 | 811 | | |
831 | 812 | | |
832 | 813 | | |
| |||
852 | 833 | | |
853 | 834 | | |
854 | 835 | | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | 836 | | |
861 | 837 | | |
862 | 838 | | |
863 | 839 | | |
864 | 840 | | |
865 | 841 | | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | 842 | | |
878 | 843 | | |
879 | | - | |
880 | 844 | | |
881 | 845 | | |
882 | 846 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 107 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
203 | 112 | | |
204 | 113 | | |
205 | 114 | | |
| |||
0 commit comments