Repository navigation
Commit 85fbf9a
committed
fix(openai-chat): heartbeat while buffering tool-call deltas
Tool-call deltas are buffered until a terminal signal, so this adapter
can consume upstream frames for a long time while yielding nothing. The
Responses bridge arms its stall watchdog on ADAPTER activity, not socket
activity, so a model streaming a large argument payload was
indistinguishable from a hung upstream and could have its turn aborted
while it was progressing normally.
Found while investigating #2156. It is not the reported error -- that
one is the EOF fail-closed guard, and the guard is correct: a stream
that ends mid tool call with neither finish_reason nor [DONE] may have
truncated the arguments, and promoting them would execute a partial
call. But the silent buffering phase is our own hazard and it is worth
closing on its own.
A heartbeat is invisible downstream: the bridge consumes it to re-arm
the watchdog and emits nothing. The Cursor, Anthropic, Google, and Kiro
adapters already use exactly this for their own silent phases.
The two test collectors now drop heartbeats, which keeps their
assertions about the wire the client actually sees.1 parent 749ab22 commit 85fbf9a
3 files changed
Lines changed: 43 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1743 | 1743 | | |
1744 | 1744 | | |
1745 | 1745 | | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
1746 | 1756 | | |
1747 | 1757 | | |
1748 | 1758 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
920 | 923 | | |
921 | 924 | | |
922 | 925 | | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
923 | 951 | | |
0 commit comments