Skip to content

Fix js_repl view_image attachments in nested tool calls#12725

Merged
fjord-oai merged 2 commits intomainfrom
fjord/js_repl_view_image
Feb 25, 2026
Merged

Fix js_repl view_image attachments in nested tool calls#12725
fjord-oai merged 2 commits intomainfrom
fjord/js_repl_view_image

Conversation

@fjord-oai
Copy link
Copy Markdown
Contributor

Summary

  • Fix js_repl so await codex.tool("view_image", { path }) actually attaches the image to the active turn when called from inside the JS REPL.
  • Restore the behavior expected by the existing js_repl image-attachment test.
  • This is a follow-up to #12553, which changed view_image to return structured image content.

Root Cause

  • #12553 changed view_image from directly injecting a pending user image message to returning structured function_call_output content items.
  • The nested tool-call bridge inside js_repl serialized that tool response back to the JS runtime, but it did not mirror returned image content into the active turn.
  • As a result, view_image appeared to succeed inside js_repl, but no input_image was actually attached for the outer turn.

What Changed

  • Updated the nested tool-call path in js_repl to inspect function tool responses for structured content items.
  • When a nested tool response includes input_image content, js_repl now injects a corresponding user Message into the active turn before returning the raw tool result back to the JS runtime.
  • Kept the normal JSON result flow intact, so codex.tool(...) still returns the original tool output object to JavaScript.

Why

  • js_repl documentation and tests already assume that view_image can be used from inside the REPL to attach generated images to the model.
  • Without this fix, the nested call path silently dropped that attachment behavior.

@fjord-oai fjord-oai force-pushed the fjord/js_repl_view_image branch from f73da3c to d0dcc9b Compare February 25, 2026 01:27
@fjord-oai fjord-oai merged commit 125fbec into main Feb 25, 2026
37 of 39 checks passed
@fjord-oai fjord-oai deleted the fjord/js_repl_view_image branch February 25, 2026 02:23
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants