Make the 16-image conversation limit configurable and batching-aware
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- c
- Ambito
- ai, backend, performance
Direzione di ricerca
Trace the fixed 16-image checks and replay structures in visible_image_key, visible_prompt_key, and build_live_prompt_suffix, then inspect how --batched-session is parsed and applied. Verify the 16/17-image reproducer and text-only replay behavior. Done means --max-images controls validation and replay bookkeeping, defaults differ for batched sessions, errors show actual and configured counts, and the replay limit is documented.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
ds4-server rejects requests containing more than 16 images:
size_t count = 0;
for (int i = 0; msgs && i < msgs->len; i++)
count += msgs->v[i].images.len;
if (count > 16) {
snprintf(err, errlen, "too many images; at most 16 are allowed");
return false;
}
This counts images across the submitted history, not only the newest turn.
DS4 requires Chat Completions and Anthropic clients to replay conversation history. Its Responses endpoint likewise rejects durable previous_response_id/conversation references and instructs clients to replay the full input.
The request limit therefore becomes a cumulative conversation limit. Once history contains 17 images, every subsequent request fails before inference, including text-only turns. Retrying cannot recover because it submits the same history. The client must rewrite or discard history, and the model cannot handle the condition because it never receives another turn.
This is easy to reach in agent workflows that retain screenshots or other image tool results.
Reproducer
Submit a request containing N small images:
| Images | Result |
|---|---|
| 16 | 200 |
| 17 | 400: too many images; at most 16 are allowed |
Append a text-only message and replay the same history. The request returns the same 400 before prefill.
Current implementation
The limit was introduced with server-side vision in 4771329 (2026-08-28). It is also embedded in replay bookkeeping:
- Request validation rejects
count > 16. visible_image_keycontainsoffsets[16].visible_prompt_keyrejectsreq->image_count > 16.build_live_prompt_suffixrejectsreq->image_count > 16and usesds4_vision_span spans[16].
Later image-embedding caching avoids encoder execution on cache hits, although request-owned embedding memory still scales with image count.
Relation to --batched-session
Cold image encoding holds the global inference_mu. With --batched-session N>1, an image-heavy request can therefore delay other resident sessions, making a conservative default useful for fairness.
With one resident session, there is no cross-slot inference contention. Request memory and abuse protection still justify a limit, but the case for a low ceiling of 16 is weaker: the operator may prefer accepting higher latency or memory use over making the conversation unusable.
Requested change
Add:
--max-images N
Suggested defaults:
--batched-session N>1: default to 16.- One resident session: use a higher or resource-derived default.
- An explicit
--max-imagesvalue overrides either default.
Implementation would need to replace the fixed [16] replay structures and validation literals with the configured limit.
Also:
-
Document that replayed history counts toward the limit.
-
Include the actual and configured counts in the error:
request contains 17 images; server limit is 16 (--max-images)
This preserves a conservative fairness bound for batched serving while allowing single-session and replay-heavy deployments to choose an appropriate limit.
Happy to make a PR if the solution direction is ok.
- Lingua principale
- C
- Stelle
- 24.4k
- Fork
- 2.4k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di antirez/ds4
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
antirez/ds4#1189 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
antirez/ds4#1173 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
antirez/ds4#1032 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
awslabs/aws-c-common#1319 ·
-
editor/integration
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
DeusData/codebase-memory-mcp#3130 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 13 giorni
-
DBMS_UTILITY.FORMAT_ERROR_STACK exceeds the 2000-byte limitForse già presa @coder999o l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
zephyrproject-rtos/zephyr#127560 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni