-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
Images in transcript poison session when model doesn't support vision (HTTP 400 loop) #29290
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Bug
When an image enters the session transcript (webchat upload, tool result, etc.) and the model provider does not support vision, the session enters an unrecoverable error loop:
- Image is persisted in transcript as a user turn
- Model rejects the request (HTTP 400: "vision is not enabled for this organization")
- No assistant reply is saved (due to the error)
pruneProcessedHistoryImages()only strips images from turns before the last assistant reply — since no assistant reply was saved, the image turn is never pruned- Every subsequent message re-sends the image → 400 forever
- Only fix is
/newor/reset
Root Cause
Two issues:
-
No vision-gating on transcript images: Even when
modelHasVisionisfalse(model resolves withinput: ["text"]), image blocks in the transcript are still sent to the provider. There is no step that strips image content from history/prompt when the model cannot handle it. -
Poison turn loop:
pruneProcessedHistoryImages()only prunes images from turns before the last assistant message. If the image turn caused a failure (no assistant reply saved), it remains after the last assistant turn and is never pruned — creating a permanent failure loop.
Expected Behavior
- Image blocks should be stripped from the transcript context when the model does not support vision (
inputdoes not include"image") - Alternatively, failed turns containing images should be prunable even without a subsequent assistant reply
Reproduction
- Configure a model provider that does not support vision (e.g.
github-copilot/claude-opus-4.6) - Do not configure
imageModelfallback - Upload/paste an image in webchat
- Observe HTTP 400 on every subsequent message until
/new
Affected Code
src/agents/pi-embedded-runner/run/history-image-prune.ts— prune logic only covers already-answered turnssrc/agents/pi-embedded-runner/run/attempt.ts:334—modelHasVisionis computed but not used to strip images from context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Give feedbackNo fields configured for issues without a type.