mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
deddf0012f
A provider can accept a request, return response headers, and then never send a byte of body data. The connection-phase request timeout was cleared as soon as headers arrived, so nothing bounded that wait and the agent turn hung indefinitely after a tool call completed: step-finish:tool-calls was recorded and the next step-start never arrived, with the HTTP server still responsive. Extend the same configured timeout deadline to the wait for the response body's first byte. The connection-phase timer covers the fetch up to headers; once headers arrive, the remaining deadline is handed to a first-byte guard that aborts the request if no data arrives. After the first byte the guard becomes a passthrough, so idle gaps inside an already streaming response (reasoning, buffering, slow token generation) are never touched and remain opt-in via chunkTimeout. This is a transport-level signal (bytes on the wire, before any content) rather than the absence of normalized AI SDK events, so it cannot fire on long prompt processing or reasoning the way the reverted stream watchdog did. timeout: false still disables the bound entirely. Adds a hermetic regression test that injects a simulated stalled socket through the provider's own fetch option via the plugin config hook, so the SDK, Kilo's fetch wrapper, SSE parsing, the processor and the agent loop all stay production code. The stalled request is transient, so the test asserts the turn recovers by retrying and completing instead of freezing. The test goes red without the fix (no retry, frozen at step-finish) and green with it. Refs #8656