[CRITICAL]: Task execution stops unexpectedly with local vLLM (Qwen3.5-27B) and large context window
Description
Description
When running a task with a locally deployed Qwen3.5-27B model via vLLM, the execution stops unexpectedly before completion. The model is configured with a 128K token context window.
Expected Behavior
The task should run continuously and complete successfully (either with a final answer or a proper error).
Actual Behavior
The task stops unexpectedly in the middle of execution. Kilo Code’s loading indicator disappears, and no further output is produced. No explicit error message is shown in the UI. I had to write "continue" in chat for resuming task.
Heap snapshot
heap-9136-2026-04-27T061436901Z.zip
Plugins
No response
Kilo version
7.2.14
Steps to reproduce
- Start VS Code Kilo Code extension (v7.2.14).
- Start a new task, for example: "Refactor the error handling logic in a large source file (>1500 lines)." or Create new component.
- Wait and observe — the task stops mid‑way.
Operating System
Windows 10
The same in Kilo CLI
The same on qwen3.6-27B with latest kilo version and cloud model.
Heap snapshot
Same
@marius-kilocode
Same issue https://github.com/Kilo-Org/kilocode/issues/8476
Local fix
Fix: Premature Session Termination with Qwen3.5 27B
Problem
When using Qwen/Qwen3.5-27B model via OpenAI-compatible API, the agent would prematurely terminate after tool call execution. Users were forced to type "continue" to resume work.
Analysis
Logs revealed the following sequence:
finish-step: stop
loop check: { lastAssistantFinish: "stop", ... }
exiting loop: { finish: "stop", ... }
Root Cause: The Qwen3.5 27B model, after executing a tool call, was responding with an empty message containing finish_reason="stop" (without any text content or subsequent tool calls). The agent interpreted this as session completion and exited the loop.
Solution
File: packages/opencode/src/session/prompt.ts:368-376
Change: Added content presence check for the last assistant message before exiting the loop.
// BEFORE
if (
lastAssistant?.finish &&
!["tool-calls", "unknown"].includes(lastAssistant.finish) &&
lastUser.id < lastAssistant.id
) {
break
}
// AFTER
const lastAssistantMsg = msgs.find(m => m.info.id === lastAssistant?.id)
const hasContent = lastAssistantMsg && lastAssistantMsg.parts.some(p => p.type === "text" || p.type === "tool")
if (
lastAssistant?.finish &&
!["tool-calls", "unknown"].includes(lastAssistant.finish) &&
lastUser.id < lastAssistant.id &&
hasContent // ← NEW CHECK
) {
break
}
Logic
The agent now exits the loop only if:
finishis not"tool-calls"or"unknown"- The last user message is older than the last assistant message
- NEW: Assistant message contains content (text or tool)
If Qwen sends an empty message with finish="stop", the agent does not exit the loop and waits for the next iteration.
Just had an agent running fine with Qwen3.6 35B A3B in LM Studio for a longer session. Those local models are hard to setup locally correctly.
The above suggested fix is probably not very safe since empty assistant messages with finish="stop" are normally a valid terminal state.
Can you try if Qwen3.6 works better for you?
@marius-kilocode The problem in Dense models (Qwen3.5 27B, Qwen3.6 27B). Qwen3.6 35B A3B has MoE architecture and there is no problems (or I accidentally did not notice). Unexpected task termination only on Qwen3.5 27B/Qwen3.6 27B. Tested on both local and cloud models. I understand that fix is not safe, just in case of detailing problem.
I guess the problem might be on Qwen3.5 9B too
@marius-kilocode , I experience same problem on Qwen3.6 35B A3B.
Same here on Qwen3.6 35B A3B
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please reopen it or create a fresh new one.