Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chunk-idle-timeout-default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kilocode/cli": patch
---

Prevent stalled model streams from leaving agent and subagent sessions stuck indefinitely. Apply a 60,000 ms chunk idle timeout by default for normal agent model streams, with prepared request, model, and agent overrides and provider-level fallbacks still winning as before.
3 changes: 2 additions & 1 deletion packages/opencode/src/kilocode/session/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { KiloSessionOverflow } from "./overflow"

const SAFETY = 2048
const MIN_OUTPUT = 1024
const DEFAULT_CHUNK_IDLE_MS = 60_000

export namespace KiloLLM {
// Stream failures and interruptions propagate while text deltas are collected.
Expand All @@ -27,7 +28,7 @@ export namespace KiloLLM {
? input.options["chunkTimeout"]
: typeof input.fallback?.["chunkTimeout"] === "number"
? input.fallback["chunkTimeout"]
: undefined
: DEFAULT_CHUNK_IDLE_MS
Comment thread
iscekic marked this conversation as resolved.
Resolved
if (!value) return {}
input.log?.debug("chunk idle timeout configured", { chunkTimeout: value })
return { timeout: { chunkMs: value } }
Expand Down
4 changes: 2 additions & 2 deletions packages/opencode/test/kilocode/session/llm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ describe("kilocode.session.llm.timeout", () => {
expect(result).toEqual({ timeout: { chunkMs: 30_000 } })
})

test("omits the timeout when it is not configured", () => {
expect(KiloLLM.timeout({ options: {} })).toEqual({})
test("defaults the chunk idle timeout to 60_000 ms when no override is configured", () => {
expect(KiloLLM.timeout({ options: {} })).toEqual({ timeout: { chunkMs: 60_000 } })
})
})

Expand Down
Loading