Skip to content

Commit 2a8b81e

Browse files
committed
docs(openai-chat): stop attributing the heartbeat to #2156
1 parent 9a93497 commit 2a8b81e

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎src/adapters/openai-chat.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,12 @@ export function createOpenAIChatAdapter(provider: OcxProviderConfig): ProviderAd
17471747
// consume upstream frames for a long time while yielding nothing. The Responses
17481748
// bridge reads adapter activity, not socket activity, so a model that streams a
17491749
// large argument payload looks identical to a hung upstream and the stall
1750-
// watchdog can abort a turn that was progressing normally (#2156).
1750+
// watchdog can abort a turn that was progressing normally.
1751+
//
1752+
// Found while investigating #2156, but it is NOT that bug: a stall abort emits
1753+
// `response.incomplete` with `upstream_stall_timeout` from the bridge, whereas
1754+
// that report shows the adapter's own end-of-stream error after `reader.read()`
1755+
// returned EOF with tool calls still pending. Different path, different frame.
17511756
//
17521757
// A heartbeat is invisible downstream — the bridge consumes it to re-arm the
17531758
// watchdog and emits nothing — which is the same remedy the Cursor, Anthropic,

‎tests/openai-chat-hardening.test.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function collect(stream: AsyncGenerator<AdapterEvent>): Promise<AdapterEve
4242
const events: AdapterEvent[] = [];
4343
// Heartbeats are invisible downstream: the bridge consumes them to re-arm its stall
4444
// watchdog and emits nothing. Dropping them here keeps these assertions about the wire
45-
// the client actually sees (#2156).
45+
// the client actually sees.
4646
for await (const event of stream) if (event.type !== "heartbeat") events.push(event);
4747
return events;
4848
}
@@ -924,10 +924,14 @@ describe("openai-chat response_format emission", () => {
924924
});
925925
});
926926

927-
// #2156: tool-call deltas are BUFFERED until a terminal signal, so this adapter can consume
928-
// upstream frames for a long time while yielding nothing downstream. The Responses bridge
929-
// arms its stall watchdog on ADAPTER activity, not socket activity, so a model streaming a
930-
// large argument payload was indistinguishable from a hung upstream.
927+
// Tool-call deltas are BUFFERED until a terminal signal, so this adapter can consume upstream
928+
// frames for a long time while yielding nothing downstream. The Responses bridge arms its
929+
// stall watchdog on ADAPTER activity, not socket activity, so a model streaming a large
930+
// argument payload was indistinguishable from a hung upstream.
931+
//
932+
// Found while investigating #2156 but deliberately NOT claimed as its fix: a stall abort
933+
// emits `response.incomplete` with `upstream_stall_timeout`, while that report shows the
934+
// adapter's own EOF error with tool calls still pending. This pins the mechanism only.
931935
test("tool-call deltas emit heartbeats so a long buffering phase is not read as a stall", async () => {
932936
const adapter = createOpenAIChatAdapter(provider());
933937
const frames = ['data: ' + JSON.stringify({ choices: [{ delta: { tool_calls: [{ index: 0, id: "call_a", function: { name: "shell", arguments: "" } }] } }] }) + '\n\n'];

0 commit comments

Comments
 (0)