Repository navigation
Description
Problem
A long GGUF chat waiting for tool approval can leave another chat queued while the monitor reports no active generations and four free serving slots. The approval wait retains the first chat's context-budget commitment, so parking its serving slot alone does not let the queued chat run.
Live reproduction
Reproduced on main 999dd8500f using the real Studio HTTP API and real Qwen3-4B-Instruct-2507 UD-Q4_K_XL inference on an RTX 5070 Ti under WSL/Linux. Runtime: 35,000 context, four effective slots, --kv-unified --cache-ram 0.
- Start chat A with synthetic reference history, Python enabled, and
permission_mode: ask. Ask it to calculate17 * 23with Python. - Wait for the real
tool_startevent withawaiting_confirmation: true, then leave it unanswered. - In a separate session, ask chat B to reply
hello. Both requests enable Python and omit an explicit output limit. - Observe B for five seconds, then resolve A's approval.
| A history | B completes while approval is pending | Monitor |
|---|---|---|
| Fresh chat | Yes | 0 active, 0 queued, 4 free |
| 80,000 characters of reference history | Yes | 0 active, 0 queued, 4 free |
| 112,000 characters of reference history | No | 0 active, 1 queued, 4 free |
Character counts above are not measured token counts. The longer case reproduced with both Allow and Deny: B completed after the decision and A's turn finished.
Expected behavior / safety constraint
A chat waiting on a human should be suspendable so other chats can use reclaimable context capacity. Any fix must release actual resident KV safely before returning its reservation, and reacquire capacity before the suspended chat resumes. Simply subtracting the parked lease's token commitment would risk overcommitting the shared cache. If capacity cannot be reclaimed, the UI should at least explain the context-budget wait rather than imply free slots guarantee progress.
Original desktop report
Windows 11, desktop v0.1.808-beta, package 2026.9.4, llama.cpp b10840-mix-d5c17a0, RTX 5090, Qwen3.8-27B UD-Q4_K_XL. Multiple chats work around 30k configured context but queue around 35k, including while a tool approval is pending. Reported settings include MTP (2 draft tokens), f16 KV, and four requested parallel slots.
The local reproduction confirms the approval/context-reservation symptom. It does not establish the exact desktop 30k-to-35k threshold, an MTP cause, or an update regression.
Related: #5481 and #5737 concern configurable concurrency; this report concerns context capacity retained during tool approval.
Activity
Imagineer99 commentedon Sep 9, 2026
Additional report from the same Windows setup:
got exception: speculative batch index 16 is not inside the current sub-batch [0, 16).These are user-reported observations, not results from our local reproduction. The exact one-token threshold and speculative sub-batch failure need separate diagnosis; neither is established as caused by approval parking.
PR #10673 addresses the independently reproduced context reservation retained during a tool approval wait. Its live A/B proof and 150 passing tests do not establish a fix for the threshold, API panel stall, or speculative-decoding error.
Imagineer99 commentedon Sep 9, 2026
Further isolation from the reporter: changing MTP to Auto still produced the speculative sub-batch errors; turning speculative decoding Off allowed six shorter prompts to finish. Screenshots show
/api/chat-runs/producerfailures with speculative batch indices 8, 12 and 19 outside[0, 8).Source investigation found the exact error string in the local llama.cpp
server-context.cpp, inpost_decodewhen a speculative batch index falls outside the current sub-batch. The adjacent source comment explicitly references ggml-org/llama.cpp#24840, which describes speculative index handling when decode batches are split. This is an engine speculative-batching error, not evidence of a six-chat application thread cap.Studio Auto mode can still select MTP for supported Qwen models, so MTP -> Auto is not necessarily a test with speculative decoding disabled. We have not yet verified the reporter's exact effective Auto configuration or independently reproduced this speculative failure.
The API-panel stall and exact 30,000/30,001 threshold remain unexplained. PR #10673 addresses approval/cache-reservation parking only.
Imagineer99 commentedon Sep 11, 2026
Concurrent context overflow reproduced independently
Pinned baseline:
1ad44677d4. Real Studio HTTP requests and Qwen3-1.7B UD-Q4_K_XL on RTX 5070 Ti under WSL/Linux; 30,000 context, three verified effective slots, unified KV and cache RAM disabled. The reported Nemotron MXFP4_MOE model was not cached, so this is a mechanism reproduction, not an exact-model reproduction.The input contains 4,500 space-separated numeric record IDs (1000 through 5499), followed by a request to write integers in order, with a 1,024-token output cap and thinking disabled.
Context size has been exceededand unsuccessful KV allocation retries down to batch size 1.The numeric input fits individually, but the character-based estimate undercounts it by almost 4x and admits more total context than the shared cache can hold. This is separate from approval parking and is not fixed by PR #10673. Current upstream
27a4ff6a9bstill uses the same estimator in_openai_llama_admission_tokens; the complete live test was run on the pinned baseline, not that latest head.The original Nemotron 30k report is consistent with this class of failure, but we have not established that its particular prompts hit this undercount. The 220k result would give much more aggregate headroom; it does not prove the admission estimate is correct.
Count prepared API prompts before GGUF admission (unslothai#15294)