Commit 6c57d2a
committed
fix local codex review comment
- [P0] Delay streaming session persistence until after filter — packages/agents-core/src/run.ts:936-969
For streaming runs we call ensureStreamInputPersisted?.() on the first turn before #prepareModelCall runs (line 936). ensureStreamInputPersisted immediately persists
sessionInputItemsToPersist and flips its internal persisted flag. Later, #prepareModelCall invokes applyCallModelInputFilter, which may redact or truncate the turn input and
updates sessionInputItemsFiltered. However, the second ensureStreamInputPersisted?.() (line 968) is a no-op because the persisted flag is already true, so the session history
now contains the unfiltered, unredacted input that the filter was supposed to scrub. This leaks exactly the data the caller asked us not to keep. We need to defer the first
persistence until after the filter (or otherwise allow the post-filter call to write the sanitized items) so that streaming memory mirrors the filtered payload.1 parent 0c5ba85 commit 6c57d2a
2 files changed
+60
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
938 | | - | |
939 | 938 | | |
940 | 939 | | |
941 | 940 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
813 | 873 | | |
814 | 874 | | |
815 | 875 | | |
| |||
0 commit comments