compileChatMessages prunes the user turn out of a tool loop; Ollama's qwen3.8 renderer then returns 500 "no user query found in messages"
Maintainer thường phản hồi trong vòng 8 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- ollama, typescript
- Lĩnh vực
- ai
Hướng nghiên cứu
Start in compileChatMessages in core/llm/countTokens, where the trailing tool sequence is protected and older history is shifted off the front. Run the repro: [system, user, 30 × (assistant toolCalls, tool 2000 chars)] with knownContextLength: 4000 and maxTokens: 1000, then inspect compiledChatMessages. Done means the last user message survives pruning, its tokens are reserved alongside the system and tool sequence, and the reporter's regression test passes. The reporter's local patch is a useful reference, but check it against the existing pruning tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version: Continue 2.0.0 (VS Code, Windows), provider openai against Ollama 0.34.0 /v1,
model qwen3.8:27b with num_ctx 131072 and contextLength: 131072.
What happens. In a long agent session (many tool calls, large tool results),
compileChatMessages (core/llm/countTokens) prunes history from the top until it fits
contextLength. It protects the system message and the trailing tool sequence returned by
extractToolSequence, and shifts everything else from the front. When the trailing sequence is
[assistant(tool_calls), tool, …], the first message to go is the opening user turn. The request
then reaches the provider as [system, assistant(tool_calls), tool, …] with no user message.
Ollama's qwen3.8 renderer (model/renderers/qwen35.go, validateMessages, qwen3.8 variant only)
rejects that list: HTTP 500 no user query found in messages. The chat shows the 500 and the
session is dead until the user compacts or starts over. ollama/ollama#17778 tracks the server side
(Ollama's own truncation can produce the same shape), and the maintainer there says the client
should manage the message list rather than rely on the server.
Independent of the 500, a pruned user turn also means the model keeps calling tools without the
task it was asked to do.
Expected. Pruning never drops the last user message. Reserve its tokens next to the system
message and the trailing tool sequence, and keep it in place (or move it to the head) when the
history before it is pruned.
Repro. Any tool loop that exceeds the window; or call compileChatMessages with
[system, user, 30 × (assistant toolCalls, tool 2000 chars)], knownContextLength: 4000,
maxTokens: 1000 and inspect compiledChatMessages: no user role remains. (We run exactly that
against the installed bundle as a regression test.)
Local patch we run (in compileChatMessages, 2.0.0 bundle, works in our sessions):
inputTokensAvailable -= lastMessagesTokens;
const pinnedUserMsg = toolSequence.some((m) => m.role === "user") ? void 0 : [...msgsCopy].reverse().find((m) => m.role === "user");
inputTokensAvailable -= pinnedUserMsg ? countChatMessageTokens(modelName, pinnedUserMsg) : 0;
…
const pinnedIndex = pinnedUserMsg ? msgsCopy.indexOf(pinnedUserMsg) : -1;
const pinnedEntry = pinnedIndex >= 0 ? historyWithTokens.splice(pinnedIndex, 1)[0] : void 0;
if (pinnedEntry) currentTotal -= pinnedEntry.tokens;
let prunedCount = 0;
while (historyWithTokens.length > 0 && currentTotal > inputTokensAvailable) {
… existing loop, counting shifted entries in prunedCount …
}
if (pinnedEntry) {
historyWithTokens.splice(Math.max(0, pinnedIndex - prunedCount), 0, pinnedEntry);
currentTotal += pinnedEntry.tokens;
}
Happy to open a PR if this shape is acceptable.
- Ngôn ngữ chính
- TypeScript
- Star
- 36.5k
- Fork
- 5.6k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của continuedev/continue
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
continuedev/continue#13486 ·
Maintainer thường phản hồi trong vòng 8 ngày
-
Chat panel overflows horizontally when VS Code zoom level is increased (Cmd/Ctrl + +)Có thể đã có người làm @tang-ontheway đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
continuedev/continue#13483 ·
Maintainer thường phản hồi trong vòng 8 ngày
-
Docs: show tool selection for a shared remote MCP endpointCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
continuedev/continue#13464 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 8 ngày
-
Inline code becomes unreadable in VS Code high-contrast themesCó thể đã có người làm @aminesayagh đã nhận 21 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
continuedev/continue#13424 ·
Maintainer thường phản hồi trong vòng 8 ngày
-
create_new_file writes a JSON file on one line when the model sends its contents as a JSON valueCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
continuedev/continue#13363 ·
Maintainer thường phản hồi trong vòng 8 ngày
Tất cả issue của continuedev/continue
Issue tương tự
-
Type/Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
OpenNSW/nsw-srilanka#1259 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
oxc-project/tsrs#1010 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Fission-AI/OpenSpec#2260 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: ESP 1 UKĐang mởcheck:passed streams:add
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:infra area:storage bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
THU-MAIC/OpenMAIC#2311 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày