Skip to content

fix(responses): preserve image tool_choice without pass-through - #2218

Merged
looplj merged 2 commits into
looplj:unstablefrom
llc1123:fix/responses-image-tool-choice
Aug 13, 2026
Merged

fix(responses): preserve image tool_choice without pass-through#2218
looplj merged 2 commits into
looplj:unstablefrom
llc1123:fix/responses-image-tool-choice

Conversation

@llc1123

@llc1123 llc1123 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • preserve Responses type-only tool choices such as {"type":"image_generation"} during inbound conversion
  • omit tool_choice.name on outbound unless a function name is present
  • add regression coverage for gpt-5.5 + image_generation using gpt-image-2 when body pass-through is disabled

Scope

This is intentionally separate from #2217. This PR only fixes the non-pass-through transformer path where tool_choice became {} and Codex returned Missing required parameter: 'tool_choice.type'.

Test

  • cd llm && go test ./transformer/openai/responses -run 'Test(OutboundTransformer_TransformRequest_ImageGenerationToolChoice|ConvertToolChoiceToLLM)' -count=1

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of image-generation tool choices when no function name is provided.
    • Requests now correctly omit an unnecessary tool name while preserving the selected tool type.
    • Ensured image-generation requests retain the appropriate model and tool configuration.
  • Tests

    • Added coverage for inbound and outbound image-generation tool choice conversion.

llc1123 and others added 2 commits August 13, 2026 14:26
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 64f27b6d-2efa-406c-93d2-39769bf3a583

📥 Commits

Reviewing files that changed from the base of the PR and between fae797d and ddd73e4.

📒 Files selected for processing (4)
  • llm/transformer/openai/responses/inbound.go
  • llm/transformer/openai/responses/inbound_test.go
  • llm/transformer/openai/responses/outbound_convert.go
  • llm/transformer/openai/responses/outbound_test.go

📝 Walkthrough

Walkthrough

The OpenAI Responses transformers now preserve non-function tool choice types without requiring a name. Outbound conversion omits empty names. Tests cover inbound conversion and outbound image-generation serialization.

Changes

Image-generation tool choice handling

Layer / File(s) Summary
Inbound tool choice normalization
llm/transformer/openai/responses/inbound.go, llm/transformer/openai/responses/inbound_test.go
Inbound conversion creates a named tool choice when Type is set. It assigns the nested function name only when present. Tests cover a name-less image_generation choice.
Outbound tool choice serialization
llm/transformer/openai/responses/outbound_convert.go, llm/transformer/openai/responses/outbound_test.go
Outbound conversion omits the name field when the function name is empty. Tests verify image_generation type serialization and the gpt-image-2 tool model.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to ddd73

This localized change preserves image tool-choice behavior during request conversion and adds regression coverage; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

Suggested reviewers: looplj

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: preserving image tool choices in the Responses transformer without pass-through.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@looplj
looplj merged commit d1cde09 into looplj:unstable Aug 13, 2026
5 checks passed
caolib added a commit to caolib/axonhub that referenced this pull request Aug 13, 2026
* upstream/unstable: (48 commits)
  fix(codex): skip pass-through for unsupported response limits (looplj#2217)
  fix(responses): preserve image tool_choice without pass-through (looplj#2218)
  chore(actions): upgrade workflows to node24 actions (looplj#2219)
  fix(prompts): Parse project GUIDs in prompt schema (looplj#2200)
  feat: add xai_responses channel type (looplj#2212)
  fix(responses): harden stream terminal, retry, and resource boundaries (looplj#2196)
  fix(trace): only persist explicitly identified traces (looplj#2208)
  feat: hide unroutable configured models from public lists (looplj#2215)
  feat(quota): track OpenCode Go quota via official usage API (looplj#2204)
  fix: align codex quota bar colors (looplj#2166)
  feat(quota): add Charm Hyper credit balance checker (looplj#2199)
  fix(i18n): change currency code example from RMB to CNY (looplj#2202)
  feat: unify auto-refresh controls and stabilize list animations (looplj#2198)
  opt: anthropic signature recognization (looplj#2197)
  fix: model associate condition caused model not found, close looplj#2183 (looplj#2194)
  fix(responses): retry incomplete streams before done (looplj#2192)
  feat: show request cache rate, close looplj#2170 (looplj#2193)
  chore: add log for chat heartbeat (looplj#2191)
  fix(sqlite-time-format-compat): 兼容 SQLite TEXT 时间戳格式并修复 backup 注册时区退化 (looplj#2189)
  feat(models): add thinkingmachines as model developer (looplj#2190)
  ...

# Conflicts:
#	.github/workflows/docker-publish.yml
Edint386 pushed a commit to Edint386/axonhub that referenced this pull request Aug 24, 2026
…lj#2218)

* fix(responses): preserve type-only tool choices

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* fix(responses): omit empty tool choice names

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

---------

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
(cherry picked from commit d1cde09)
@llc1123
llc1123 deleted the fix/responses-image-tool-choice branch September 4, 2026 08:12
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