Repository navigation
Commit dea7d2c
committed
fix(responses): keep a mid-stream refusal out of continuation state
Checking only the terminal snapshot left a hole. An upstream can announce the
undeclared call in `response.output_item.added` — which trips the client guard
and sends `response.failed` — and then close with a `response.completed` whose
`output` is empty. The terminal check then sees nothing undeclared and the
refused turn enters `previous_response_id` replay state anyway.
Rejection is now sticky for the whole turn, set from every parsed payload on the
inspection side rather than derived from the terminal snapshot. That required a
seam: `SseInspectorHandlers` had no per-payload callback, so the flag could
never have been set. `onParsedPayload` is added there, invoked in `scanPayload`
before any terminal classification, and carried on
`InspectionConsumerOptions` so both `consumeForInspection` and
`consumeForResponseLogMetadata` wire it — adding it to the handler type alone
would have left the tee path silently inert.
The flag is gated on `undeclaredToolGuardActive`, the same condition as the
guard. Without that gate a no-catalog or forward-auth stream would mark every
call undeclared and stop recording continuation state for exactly the
passthrough traffic the guard deliberately stands down for.
Regression: a stream whose only undeclared item is in `output_item.added` and
whose terminal `output` is empty must give the client `response.failed` and
leave nothing for a follow-up to inherit. Driven red against the unfixed flag
before landing.1 parent cfbb3cd commit dea7d2c
3 files changed
Lines changed: 82 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
606 | 613 | | |
607 | 614 | | |
608 | 615 | | |
| |||
786 | 793 | | |
787 | 794 | | |
788 | 795 | | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
789 | 801 | | |
790 | 802 | | |
791 | 803 | | |
| |||
953 | 965 | | |
954 | 966 | | |
955 | 967 | | |
| 968 | + | |
| 969 | + | |
956 | 970 | | |
957 | 971 | | |
958 | 972 | | |
| |||
1108 | 1122 | | |
1109 | 1123 | | |
1110 | 1124 | | |
| 1125 | + | |
1111 | 1126 | | |
1112 | 1127 | | |
1113 | 1128 | | |
| |||
1158 | 1173 | | |
1159 | 1174 | | |
1160 | 1175 | | |
| 1176 | + | |
1161 | 1177 | | |
1162 | 1178 | | |
1163 | 1179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
| |||
2308 | 2309 | | |
2309 | 2310 | | |
2310 | 2311 | | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
2311 | 2328 | | |
2312 | 2329 | | |
| 2330 | + | |
2313 | 2331 | | |
2314 | 2332 | | |
2315 | 2333 | | |
| |||
2775 | 2793 | | |
2776 | 2794 | | |
2777 | 2795 | | |
| 2796 | + | |
2778 | 2797 | | |
2779 | 2798 | | |
2780 | 2799 | | |
| |||
2825 | 2844 | | |
2826 | 2845 | | |
2827 | 2846 | | |
| 2847 | + | |
2828 | 2848 | | |
2829 | 2849 | | |
2830 | 2850 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
417 | 463 | | |
418 | 464 | | |
419 | 465 | | |
| |||
0 commit comments