fix(agent): stop unprocessable image retry loops#3424
Conversation
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
There was a problem hiding this comment.
Solid defensive fix for a concrete infinite-retry bug. All three layers (input conversion, PostToolUse hook, session JSONL healer) are purely additive guards — valid images are untouched, only images that would 400 anyway are replaced with text notices. The estimateBase64Bytes extraction from cloud-prompt.ts to @posthog/shared is a clean deduplication with identical logic, and all placements respect the project's import rules. Test coverage is thorough across all new paths including the URL-sourced image (unchanged) edge case.
|
Reviews (1): Last reviewed commit: "fix(agent): guard Read image output befo..." | Re-trigger Greptile |
Prevent invalid direct attachments and Read image output from reaching the model, and heal persisted session transcripts that already contain invalid image blocks.
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
005ddbe to
65e8755
Compare
There was a problem hiding this comment.
Solid defensive fix for a concrete infinite-retry bug — valid images pass through unchanged; only images that would 400 anyway are replaced with text notices. The three layers (input conversion, PostToolUse hook, session JSONL healer) are purely additive, import boundaries are respected, and test coverage is thorough across all new paths including the greptile-bot-flagged edge cases (empty data, bare array wrapping) that were fixed in follow-up commits.
Problem
Once an image the API cannot process enters a cloud session, the same image-processing error can reappear after subsequent tool calls and on later resumes. The agent may continue working, but repeatedly resubmitting the invalid image wastes time and usage and persisted session transcripts can then replay the same invalid content on every resume.
closes #3422
Changes
Readtool output throughPostToolUsebefore the next model request, preventing same-turn retry loopstool_resultimages with a short text notice