Commit b6ea02f
committed
fix(sdk): don't overwrite a committed response when a post-response step throws
The chat.agent try block spans the whole turn, so a throw from a post-response
step (a customer onBeforeTurnComplete/onTurnComplete hook, a late conversion)
lands in the error handler after the response was already committed. Track a
per-turn responseCommitted flag and keep capturedPartialResponse pointed at the
enriched committed message, so the error path reports it without re-recovering a
raw partial and clobbering the committed message, its queued data parts, or a
prior turn's compaction. Also use truthy id checks to match the success path.1 parent 1fe685c commit b6ea02f
2 files changed
Lines changed: 72 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6396 | 6396 | | |
6397 | 6397 | | |
6398 | 6398 | | |
| 6399 | + | |
6399 | 6400 | | |
6400 | 6401 | | |
6401 | 6402 | | |
| |||
7404 | 7405 | | |
7405 | 7406 | | |
7406 | 7407 | | |
| 7408 | + | |
| 7409 | + | |
| 7410 | + | |
| 7411 | + | |
| 7412 | + | |
7407 | 7413 | | |
7408 | 7414 | | |
7409 | 7415 | | |
| |||
7625 | 7631 | | |
7626 | 7632 | | |
7627 | 7633 | | |
| 7634 | + | |
7628 | 7635 | | |
7629 | 7636 | | |
7630 | 7637 | | |
| |||
7935 | 7942 | | |
7936 | 7943 | | |
7937 | 7944 | | |
7938 | | - | |
7939 | | - | |
7940 | | - | |
7941 | | - | |
| 7945 | + | |
| 7946 | + | |
| 7947 | + | |
7942 | 7948 | | |
7943 | 7949 | | |
7944 | 7950 | | |
| |||
7950 | 7956 | | |
7951 | 7957 | | |
7952 | 7958 | | |
7953 | | - | |
| 7959 | + | |
7954 | 7960 | | |
7955 | 7961 | | |
7956 | 7962 | | |
| |||
7964 | 7970 | | |
7965 | 7971 | | |
7966 | 7972 | | |
7967 | | - | |
| 7973 | + | |
7968 | 7974 | | |
7969 | 7975 | | |
7970 | 7976 | | |
| |||
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
163 | 223 | | |
164 | 224 | | |
165 | 225 | | |
| |||
0 commit comments