Commit e25c7ef
committed
fix: preserve reasoning_details shape to prevent malformed responses
Follow-up to #10285.
- Preserve the original reasoning_details array structure from the API
to prevent malformed responses when sending back to providers
- Strip 'id' field from openai-responses-v1 blocks because OpenAI's
Responses API requires 'store: true' to persist reasoning blocks
(we manage conversation state client-side)
- Preserve 'id' field for other formats like xai-responses-v1
- Handle reasoning_details on string-content messages that were
previously losing this data during transformation
- Add comprehensive test coverage for reasoning_details handling1 parent 0f3df0e commit e25c7ef
File tree
4 files changed
+451
-28
lines changed- src/api
- providers
- transform
- __tests__
4 files changed
+451
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
| 364 | + | |
| 365 | + | |
365 | 366 | | |
366 | 367 | | |
367 | 368 | | |
| |||
376 | 377 | | |
377 | 378 | | |
378 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
379 | 385 | | |
380 | 386 | | |
381 | 387 | | |
| |||
438 | 444 | | |
439 | 445 | | |
440 | 446 | | |
| 447 | + | |
| 448 | + | |
441 | 449 | | |
442 | 450 | | |
443 | 451 | | |
444 | 452 | | |
445 | 453 | | |
446 | 454 | | |
447 | | - | |
448 | 455 | | |
449 | 456 | | |
| 457 | + | |
450 | 458 | | |
451 | 459 | | |
452 | 460 | | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
457 | 469 | | |
458 | 470 | | |
459 | 471 | | |
| |||
488 | 500 | | |
489 | 501 | | |
490 | 502 | | |
491 | | - | |
| 503 | + | |
492 | 504 | | |
493 | 505 | | |
494 | 506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
164 | 170 | | |
165 | 171 | | |
166 | 172 | | |
| |||
223 | 229 | | |
224 | 230 | | |
225 | 231 | | |
| 232 | + | |
| 233 | + | |
226 | 234 | | |
227 | 235 | | |
228 | 236 | | |
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
232 | | - | |
233 | 240 | | |
234 | 241 | | |
| 242 | + | |
235 | 243 | | |
236 | 244 | | |
237 | 245 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
243 | 253 | | |
244 | 254 | | |
245 | 255 | | |
246 | | - | |
247 | | - | |
248 | | - | |
| 256 | + | |
| 257 | + | |
249 | 258 | | |
250 | 259 | | |
251 | 260 | | |
| |||
282 | 291 | | |
283 | 292 | | |
284 | 293 | | |
285 | | - | |
| 294 | + | |
286 | 295 | | |
287 | 296 | | |
288 | 297 | | |
| |||
0 commit comments