Skip to content

Feat: Add base64 image support for results.#885

Open
d42me wants to merge 3 commits intoPrimeIntellect-ai:mainfrom
d42me:feature/results-base64-image-support
Open

Feat: Add base64 image support for results.#885
d42me wants to merge 3 commits intoPrimeIntellect-ai:mainfrom
d42me:feature/results-base64-image-support

Conversation

@d42me
Copy link
Collaborator

@d42me d42me commented Feb 10, 2026

Description

Add base64 image store support for results

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

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 (placeholder vs base64). In base64 mode, message_to_printable extracts/validates data:image/*;base64,... payloads into a per-message images field (with size accounting) and enforces an optional max_image_base64_chars limit.

Threads image_mode/max_image_base64_chars through Environment/EnvGroup rollout + server/client request paths and into state_to_output/states_to_outputs, records save_image_mode in GenerateMetadata, and exposes CLI support via --save-image-mode with a fail-fast default size cap; also updates sanitize_tool_calls to 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.

@d42me d42me requested a review from hallerite February 10, 2026 05:28
@d42me d42me force-pushed the feature/results-base64-image-support branch from a36c44d to d6bfbdb Compare February 19, 2026 06:18
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

raw,
image_mode=image_mode,
max_image_base64_chars=max_image_base64_chars,
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

result.append(new_msg)
else:
result.append(msg)
return result
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New function strip_nones_from_content is never used

Low Severity

strip_nones_from_content is defined but never imported or called anywhere in the codebase. A grep for its name returns only its definition. This is dead code that adds maintenance burden without providing value.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments