compileChatMessages prunes the user turn out of a tool loop; Ollama's qwen3.8 renderer then returns 500 "no user query found in messages"
メンテナーはふだん 8 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 62/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- ollama, typescript
- 領域
- ai
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 36.5k
- フォーク
- 5.6k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
continuedev/continue のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
continuedev/continue#13486 ·
メンテナーはふだん 8 日以内に返信
-
Chat panel overflows horizontally when VS Code zoom level is increased (Cmd/Ctrl + +)対応中かも @tang-ontheway が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
continuedev/continue#13483 ·
メンテナーはふだん 8 日以内に返信
-
Docs: show tool selection for a shared remote MCP endpoint対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
continuedev/continue#13464 · コメント 1 件 ·
メンテナーはふだん 8 日以内に返信
-
Inline code becomes unreadable in VS Code high-contrast themes対応中かも @aminesayagh が 21 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
continuedev/continue#13424 ·
メンテナーはふだん 8 日以内に返信
-
create_new_file writes a JSON file on one line when the model sends its contents as a JSON value対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
continuedev/continue#13363 ·
メンテナーはふだん 8 日以内に返信
continuedev/continue の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
oxc-project/tsrs#1010 ·
メンテナーはふだん 1 日以内に返信
-
area:infra area:storage bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
THU-MAIC/OpenMAIC#2311 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
docs documentation need-triage SaaS
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
enhancement from-app needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
nightly-labs/openbot#10973 ·
メンテナーはふだん 1 日以内に返信
-
status/need-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
google-gemini/gemini-cli#30328 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信