Feat: Add base64 image support for results.#885
Feat: Add base64 image support for results.#885d42me wants to merge 3 commits intoPrimeIntellect-ai:mainfrom
Conversation
a36c44d to
d6bfbdb
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| printable: dict[str, Any] = { | ||
| "role": role, | ||
| "content": " ".join(chunks).strip(), | ||
| "content": "\n\n".join(chunks).strip(), |
There was a problem hiding this comment.
Content separator changed from space to double-newline
Medium Severity
The content-part join separator in message_to_printable changed from " ".join(chunks) to "\n\n".join(chunks). This affects all callers regardless of image_mode, including the RL trainer's wandb logging path which calls messages_to_printable without image-related parameters. The output format changes from e.g. "text [audio]" to "text\n\n[audio]", potentially breaking downstream consumers expecting space-separated content.
| raw, | ||
| image_mode=image_mode, | ||
| max_image_base64_chars=max_image_base64_chars, | ||
| ) |
There was a problem hiding this comment.
Pydantic message path silently drops extracted images
Medium Severity
When message_to_printable receives a Pydantic message object (not a dict) with list content and image_mode=BASE64, it recursively processes a dict version which correctly extracts images into printable["images"]. However, model_copy(update={"content": printable.get("content", "")}) only copies the content string back to the Pydantic model — the images list is silently discarded. Any image data extracted in base64 mode is lost for Pydantic messages.
| result.append(new_msg) | ||
| else: | ||
| result.append(msg) | ||
| return result |
There was a problem hiding this comment.


Description
Add base64 image store support for results
Type of Change
Testing
uv run pytestlocally.Checklist
Note
Medium Risk
Touches core output serialization and the env client/server RPC surface; incorrect mode selection or base64 validation/limits could break saving or resume workflows for multimodal prompts.
Overview
Adds configurable image serialization for generated/saved results via new
ImageMode(placeholdervsbase64). Inbase64mode,message_to_printableextracts/validatesdata:image/*;base64,...payloads into a per-messageimagesfield (with size accounting) and enforces an optionalmax_image_base64_charslimit.Threads
image_mode/max_image_base64_charsthroughEnvironment/EnvGrouprollout + server/client request paths and intostate_to_output/states_to_outputs, recordssave_image_modeinGenerateMetadata, and exposes CLI support via--save-image-modewith a fail-fast default size cap; also updatessanitize_tool_callsto preserve pre-serialized strings and extra message fields. Tests cover env/CLI behavior, override precedence, and limit enforcement.Written by Cursor Bugbot for commit d6bfbdb. This will update automatically on new commits. Configure here.