Commit b911acf
authored
fix(oci): terminate stream on finishReason — OCI does not send [DONE] (#757)
* fix(oci): terminate stream on finishReason instead of waiting for [DONE]
OCI Generative AI does not send a `data: [DONE]` SSE marker to signal
end-of-stream. It sends a final event with `finishReason` and keeps
the connection open, causing chat_stream() to hang indefinitely.
Emit closing events (message-end / stream-end) and return from the
generator when `finishReason` is detected. The [DONE] path is kept
as a fallback for forward compatibility.
Fixes #756
* test(oci): assert stream termination and full event lifecycle
Strengthen V1 and V2 streaming integration tests to verify streams
terminate correctly and produce the expected event sequence:
- V1: stream-start → text-generation(s) → stream-end
- V2: message-start → content-start → content-delta(s) → content-end → message-end
Without these assertions the previous tests would have hung forever
on the streaming bug rather than failing with a clear error.1 parent 2598c9a commit b911acf
2 files changed
Lines changed: 58 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1058 | 1087 | | |
| 1088 | + | |
1059 | 1089 | | |
1060 | 1090 | | |
1061 | 1091 | | |
1062 | 1092 | | |
1063 | 1093 | | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
1088 | 1097 | | |
1089 | 1098 | | |
1090 | 1099 | | |
| |||
1102 | 1111 | | |
1103 | 1112 | | |
1104 | 1113 | | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1105 | 1120 | | |
1106 | 1121 | | |
1107 | 1122 | | |
1108 | 1123 | | |
1109 | 1124 | | |
1110 | 1125 | | |
1111 | 1126 | | |
| 1127 | + | |
| 1128 | + | |
1112 | 1129 | | |
1113 | | - | |
| 1130 | + | |
1114 | 1131 | | |
1115 | 1132 | | |
1116 | 1133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
| |||
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
189 | | - | |
| 194 | + | |
190 | 195 | | |
191 | 196 | | |
192 | 197 | | |
| |||
195 | 200 | | |
196 | 201 | | |
197 | 202 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | 203 | | |
202 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
203 | 213 | | |
204 | 214 | | |
205 | 215 | | |
| |||
214 | 224 | | |
215 | 225 | | |
216 | 226 | | |
217 | | - | |
218 | 227 | | |
219 | 228 | | |
220 | 229 | | |
| |||
0 commit comments