A request the API rejects (400/413) keeps its user message in history and breaks the chat
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
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Start in agent/agent.ts at Agent.send (around lines 124-127), where addUserMessage runs before run, and at retryDecision, which returns null for 400/413. The minimal first step is to drop the trailing user message when the first request of a run fails with a non-retryable 4xx. Done means a test using MockApiServer that mocks a 400 on the first send, then sends again, shows the second request has no image. The image sniffing, size cap and tool-result changes are separate pieces and can be split off.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Found in the 2026-10-09 codebase audit.
Problem
Agent.send (agent/agent.ts:124-127) calls addUserMessage and then run; nothing removes the message when the request fails for good. retryDecision returns null for 400/413, but the message stays and every later request re-sends it. Compaction keeps the last ~40k characters, so it is never summarized away.
Confirmed with MockApiServer: after a 400 on a message with an image, the next send re-sent the image.
Triggers:
- An image to a text-only custom OpenAI-compatible model (
acceptsImagesis true for every non-Claude model). - Several large images over the 32 MB request limit (413).
- Tool-result images (browser screenshots, MCP image blocks) to a model that refuses them;
acceptsImagesis checked only for user attachments. - Possibly a media type that doesn't match the bytes (taken from the extension).
Fix
When the first request of a run fails with a non-retryable 4xx before any assistant turn is recorded, discard the trailing user message (a message the API never accepted is not part of history). Also sniff image magic bytes, cap the total image size per request, and replace tool-result images with text when the model doesn't accept images.
Test
Mock a 400 on the first send, send again; the second request has no image.
- Lingua principale
- TypeScript
- Stelle
- 2
- Fork
- 2
- Merge medio
- 3h 50m
- PR unite (30g)
- 67
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 PierrunoYT/patch
-
platform: windows priority: low severity: low tests
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
PierrunoYT/patch#364 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 1/100
PierrunoYT/patch#357 ·
I maintainer di solito rispondono entro 1 giorno
-
platform: windows priority: low security severity: low tests
Difficoltà 4/5 1-2 giorni Idoneità per principianti 52/100
PierrunoYT/patch#346 ·
I maintainer di solito rispondono entro 1 giorno
-
platform: windows
Difficoltà 4/5 1-2 giorni Idoneità per principianti 52/100
PierrunoYT/patch#329 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
performance priority: low severity: low
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
PierrunoYT/patch#324 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PierrunoYT/patch
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
outline/outline#14348 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Agent import retains quotes in .env API keys followed by inline commentsForse già presa @yxr-2025 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
elie222/rakazo#2322 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
awslabs/visual-asset-management-system#804 ·
I maintainer di solito rispondono entro 1 giorno
-
用户目录有单引号时,热加载时YAML解析崩溃Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
dsh-market/dsh-market#1027 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno