Commit c95f197
committed
fix local codex review comment:
- [P1] Persist streaming session input on model errors — packages/agents-core/src/run.ts:1045-1086
When we stream a run with a session, ensureStreamInputPersisted is only invoked in the final_output and interruption branches. If the model stream rejects before either
branch is reached (for example a transient provider/network error, an abort signal, or a thrown tool error), we exit the loop via the catch path without ever calling
ensureStreamInputPersisted, so saveStreamInputToSession never runs. That drops the user’s latest turn from the session, which prevents resuming the conversation precisely when
we need memory most. We should persist the input as soon as we hand it to the model (or at least in a finally block) so streaming sessions remain consistent even when the stream
fails early.1 parent 7a489f4 commit c95f197
2 files changed
+72
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
877 | 877 | | |
878 | 878 | | |
879 | 879 | | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
880 | 890 | | |
881 | 891 | | |
882 | 892 | | |
| |||
983 | 993 | | |
984 | 994 | | |
985 | 995 | | |
986 | | - | |
| 996 | + | |
| 997 | + | |
987 | 998 | | |
988 | 999 | | |
989 | 1000 | | |
| |||
1081 | 1092 | | |
1082 | 1093 | | |
1083 | 1094 | | |
1084 | | - | |
| 1095 | + | |
1085 | 1096 | | |
1086 | 1097 | | |
1087 | 1098 | | |
| |||
1102 | 1113 | | |
1103 | 1114 | | |
1104 | 1115 | | |
1105 | | - | |
| 1116 | + | |
1106 | 1117 | | |
1107 | 1118 | | |
1108 | 1119 | | |
| |||
1129 | 1140 | | |
1130 | 1141 | | |
1131 | 1142 | | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1132 | 1146 | | |
1133 | 1147 | | |
1134 | 1148 | | |
| |||
| 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 | + | |
813 | 847 | | |
814 | 848 | | |
815 | 849 | | |
| |||
971 | 1005 | | |
972 | 1006 | | |
973 | 1007 | | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
974 | 1029 | | |
975 | 1030 | | |
976 | 1031 | | |
| |||
0 commit comments