Skip to content

feat(v1): support image-bearing Messages prompts#1974

Merged
xeophon merged 2 commits into
PrimeIntellect-ai:mainfrom
xeophon:harness-image-prompts
Jul 13, 2026
Merged

feat(v1): support image-bearing Messages prompts#1974
xeophon merged 2 commits into
PrimeIntellect-ai:mainfrom
xeophon:harness-image-prompts

Conversation

@xeophon

@xeophon xeophon commented Jul 12, 2026

Copy link
Copy Markdown
Member

Overview

Support image-bearing Messages prompts across the default, null, and Codex harnesses.

  • Default and null serialize Messages to a trace-specific transient file, pass only its path to the harness program, and delete the file immediately after parsing arguments, before MCP setup.
  • Codex folds system and user-message text into its initial prompt, materializes each base64 data-URL image in a trace-specific rollout directory, and attaches every image with a repeated -i argument.

Why

Default and null previously put the full serialized prompt in INITIAL_MESSAGES. Base64 image data can exceed process-launch limits because argv and environment data share the same budget, causing E2BIG before the harness program starts.

Codex accepts image files rather than OpenAI-style image_url content. Materializing those image parts bridges the existing Messages representation onto the Codex CLI while preserving system instructions and multiple images in their original order.

Trace-specific paths avoid task-file collisions. Prompt handoff files are removed before setup work, and Codex image files use best-effort cleanup when the program exits with runtime teardown as a fallback.

Note

Add image-bearing Messages prompt support to harnesses

  • CodexHarness now accepts structured message prompts containing image parts. Text parts are concatenated into the prompt string; base64 data:image URLs are decoded to temporary files and passed via -i arguments. Only system and user roles are accepted; invalid roles or non-base64 image URLs raise ValueError. Temporary files are cleaned up on exit.
  • All harnesses (default, null) switch from passing initial Messages via the INITIAL_MESSAGES environment variable to writing them to a per-trace JSON file and passing --initial-messages-file=<path> on the CLI. The file is deleted after reading.
  • Behavioral Change: programs that previously read INITIAL_MESSAGES from the environment will no longer receive it there.

Macroscope summarized cb1c6d2.


Note

Medium Risk
Behavior change removes INITIAL_MESSAGES for default/null; Codex adds new prompt parsing and temp file I/O on the rollout path, with validation errors for unsupported message shapes.

Overview
Adds multimodal Messages prompt handling so base64 images no longer blow process launch limits (E2BIG) when prompts are passed through argv or environment.

Default and null harnesses stop using the INITIAL_MESSAGES environment variable. For non-string prompts they write wire-format JSON to a trace-specific .vf-initial-messages-{trace.id}.json file, pass only --initial-messages-file, and the harness program loads that file and deletes it immediately on startup.

Codex harness advertises SUPPORTS_MESSAGE_PROMPT = True, can take structured Messages when both system_prompt and a non-string prompt are set, folds system/user text into Codex’s single initial prompt string, decodes data:image/...;base64,... parts into a per-trace image directory, passes them with repeated -i flags, and best-effort removes that directory after codex exec finishes. Non–system/user roles or non–base64 image URLs raise ValueError.

Reviewed by Cursor Bugbot for commit cb1c6d2. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread verifiers/v1/harnesses/default/program.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57c6e4c74a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/harnesses/default/harness.py Outdated
@xeophon xeophon force-pushed the harness-image-prompts branch from 57c6e4c to b463059 Compare July 12, 2026 14:17
@xeophon xeophon changed the title feat(v1): image-bearing message prompts in the default, null, and codex harnesses fix(v1): avoid exec limits for Messages prompts Jul 12, 2026
@xeophon xeophon force-pushed the harness-image-prompts branch from b463059 to 72492f9 Compare July 12, 2026 15:24
@xeophon xeophon changed the title fix(v1): avoid exec limits for Messages prompts feat(v1): support image-bearing Messages prompts Jul 12, 2026
Comment thread verifiers/v1/harnesses/codex/harness.py
Comment thread verifiers/v1/harnesses/default/program.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72492f99b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/harnesses/codex/harness.py Outdated
@xeophon xeophon requested a review from mikasenghaas July 12, 2026 15:36
@xeophon xeophon force-pushed the harness-image-prompts branch from 72492f9 to 5d5ab11 Compare July 12, 2026 15:38
Comment thread verifiers/v1/harnesses/codex/harness.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d5ab11990

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/harnesses/codex/harness.py
@xeophon xeophon force-pushed the harness-image-prompts branch from 5d5ab11 to c6343cb Compare July 12, 2026 15:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6343cbe54

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/harnesses/codex/harness.py Outdated
@xeophon xeophon force-pushed the harness-image-prompts branch from c6343cb to 8adb1eb Compare July 12, 2026 15:48

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8adb1eb. Configure here.

Comment thread verifiers/v1/harnesses/codex/harness.py Outdated
Comment thread verifiers/v1/harnesses/codex/harness.py
Default and null move serialized Messages out of the environment and into trace-specific transient files, deleting the handoff before any MCP setup begins.

Codex maps user Messages onto its initial prompt surface, preserves system text, accepts parameterized image data URLs, attaches every materialized image with a repeated -i argument, and removes its rollout directory with best-effort cleanup.
@xeophon xeophon force-pushed the harness-image-prompts branch from 8adb1eb to e5d5f21 Compare July 12, 2026 15:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5d5f21cf3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/harnesses/codex/harness.py Outdated
mikasenghaas
mikasenghaas previously approved these changes Jul 12, 2026
@xeophon xeophon merged commit 9eae46a into PrimeIntellect-ai:main Jul 13, 2026
9 checks passed
eligotts added a commit that referenced this pull request Jul 14, 2026
Resolves the conflict in verifiers/v1/harnesses/null/program.py: this branch's
asyncio.timeout(60) wrap around connect_mcp() lands adjacent to main's
--initial-messages-file refactor (#1974). Kept both: the timeout wrap, and main's
file-based `initial` (dropping this branch's now-stale
`initial = json.loads(os.environ.get("INITIAL_MESSAGES", "[]"))`, which would have
silently clobbered the value main's refactor already computed earlier in main()).

Also re-ran ruff format: this branch's incidental single-line reformatting of
chat()/connect_mcp() no longer matches the pinned ruff (0.15.12) target — main's
original multi-line wrapping is what ruff format now produces, confirmed by running
ruff format --diff against main's own unmodified file (no changes). Restored it so
the diff is limited to the actual timeout fix + the requires-python bump.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

2 participants