Skip to content

Cross-provider fallback retry: prompt-detected images bypass resolveRetryImages guard #43492

@mitchmcalister

Description

@mitchmcalister

Summary

detectAndLoadPromptImages in src/agents/pi-embedded-runner/run/attempt.ts scans prompt text for image file paths (e.g., ./image.png, file://..., [Image: source:...]) and loads them from disk independently of the images parameter passed through agentCommand.

When #43485 strips explicitly-supplied images on cross-provider fallback retry, prompt-detected images are still loaded and sent to the fallback provider because detectAndLoadPromptImages runs unconditionally in attempt.ts (line ~1719).

Impact

If a user's message text contains references to local image files, those images will still be loaded and forwarded to the cross-provider fallback target even after resolveRetryImages strips the explicit images payload.

Suggested fix

Gate detectAndLoadPromptImages on a cross-provider check, or pass a flag from runAgentAttempt indicating that prompt-detected images should be suppressed. This needs design input since suppressing prompt-detected images changes the fallback model's ability to understand image-referencing prompts.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions