Repository navigation
Conversation
Gemini code-execution turns stored in a session failed the next OpenAI request. Render ExecutableCode and CodeExecutionResult as the fenced text adk-python already sends, on both Chat Completions and Responses. Fixes google#1924
mangeshraut712
force-pushed
the
cursor/openai-code-execution-text-674f
branch
from
October 25, 2026 18:12
aa452e2 to
a40a51e
Compare
Contributor
Author
|
Rebased onto main and mergeable — ready when you are. |
Contributor
Author
|
CI is green on this tip (a bit behind main; happy to rebase if needed). It sends executable code parts as text in the OpenAI model path so they are not dropped. If it looks good, could you please review and merge when you get a chance? Thanks. |
Contributor
Author
|
CI is green. Sends executable code parts as text in the OpenAI model path. Please review and merge when you can. |
ktsoator
reviewed
Oct 27, 2026
ktsoator
left a comment
Contributor
There was a problem hiding this comment.
I’m not a maintainer, but this looks good to me overall, with one small suggestion on the comment wording.
ktsoator
reviewed
Oct 27, 2026
8 tasks done
wolo-lab
force-pushed
the
cursor/openai-code-execution-text-674f
branch
from
November 6, 2026 09:25
666e47b to
8577599
Compare
mangeshraut712
added a commit
to mangeshraut712/mangeshraut712
that referenced
this pull request
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Linked issue
Problem:
A Gemini turn that stores
ExecutableCodeorCodeExecutionResultmakes the next OpenAI request fail before it is sent. Both Chat Completions and Responses reject the part withopenai: unsupported content part: ExecutableCode(orCodeExecutionResult).Solution:
Send those parts as text, using the same fences as adk-python's Responses converter: a python block for the code and a
code_outputblock for the result. Both APIs do this. adk-python's Chat Completions converter drops these parts; Go deliberately preserves them there so a cross-model session does not hide the code or its output from the model.Behavior change
A request that used to fail on these parts now includes them as text. Other unsupported parts are still rejected.
Testing Plan
Unit Tests:
go test -count=1 -race -timeout 180s ./model/openaimodel/...golangci-lint run(v2.3.1) on those three internal packages reported 0 issues.With your source change reverted and your tests kept, which test fails?
Leaving the new tests in place and not passing
PartFieldCodeExecutionfrom the converters:TestBuildParams_CodeExecutionAsText(responses and completions)TestBuildParams_DropsReplayedThoughts/thought_text_riding_on_code_drops_only_the_textThey fail with
openai: unsupported content part: ExecutableCode.Removing the media-path insertion instead makes these focused cases fail by omitting the fenced code before the image:
TestBuildParams_MediaOnTheWire/executable_code_before_an_inline_image_keeps_its_order(Chat Completions)TestBuildParams_CodeExecutionAsText/code_keeps_its_place_on_a_media_message(Responses)Manual End-to-End (E2E) Tests:
No live model call. The failure is in request construction, and the tests above check the payload that would be sent.
Checklist