Commit da41a06
committed
fix(stdlib): address second-round review feedback
Three items from the second independent review:
cancel_generation(error=) — accept an optional Exception parameter.
When the orchestrator enters the except Exception path, it now passes
the caught exception to cancel_generation() so the backend telemetry
span records the real cause via set_span_error instead of a generic
RuntimeError("Generation cancelled"). The original exception still
surfaces to the consumer via astream()/acomplete(); this is purely an
OTEL accuracy fix. Backward-compatible: the default None preserves the
previous "Generation cancelled" message for the normal fail path.
stream_with_chunking docstring — the "After the stream ends (naturally
or via early exit), validate() is called" wording overstated behaviour.
The orchestrator actually skips final validate() on early exit
(test_early_exit_on_fail verifies final_validations == []). Docstring
now correctly says final validate() runs only on natural completion.
test_exception_in_stream_validate_cancels_generation docstring — the
test fails on chunk 1 so the queue never actually fills; it verifies
the cancel-on-exception path and the no-hang guarantee but does not
directly prove the worst-case "producer blocked on full queue"
scenario. Docstring now states what it actually covers and points at
test/core/ for the cancel_generation drain logic.
Assisted-by: Claude Code1 parent def10b6 commit da41a06
3 files changed
Lines changed: 40 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
| 367 | + | |
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
378 | 386 | | |
379 | 387 | | |
380 | 388 | | |
| |||
414 | 422 | | |
415 | 423 | | |
416 | 424 | | |
417 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
418 | 429 | | |
419 | 430 | | |
420 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
250 | 252 | | |
251 | | - | |
| 253 | + | |
252 | 254 | | |
253 | 255 | | |
254 | 256 | | |
| |||
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
307 | | - | |
308 | | - | |
309 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
310 | 315 | | |
311 | 316 | | |
312 | 317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
682 | 684 | | |
683 | 685 | | |
684 | | - | |
| 686 | + | |
685 | 687 | | |
686 | 688 | | |
687 | 689 | | |
| |||
702 | 704 | | |
703 | 705 | | |
704 | 706 | | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
709 | 717 | | |
710 | 718 | | |
711 | 719 | | |
| |||
736 | 744 | | |
737 | 745 | | |
738 | 746 | | |
739 | | - | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
740 | 750 | | |
741 | 751 | | |
742 | | - | |
| 752 | + | |
743 | 753 | | |
744 | 754 | | |
745 | 755 | | |
| |||
0 commit comments