Skip to content

fix: integrate hosted image tool preferences - #837

Open
Ingwannu wants to merge 2 commits into
devfrom
agent/integrate-hosted-image-tools-616
Open

fix: integrate hosted image tool preferences#837
Ingwannu wants to merge 2 commits into
devfrom
agent/integrate-hosted-image-tools-616

Conversation

@Ingwannu

@Ingwannu Ingwannu commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • integrate the hosted image-tool preference work from fix: preserve hosted image tool preferences #616 onto current dev
  • preserve the original contributor commit and authorship from @Eleven-is-cool
  • resolve the two documentation conflicts by retaining the newer DeepSeek wire-default wording alongside modelPreferHostedTools
  • update one expected schema to account for the function-schema normalization already on dev

The original PR branch does not allow maintainer edits and is now conflicting, so this integration branch carries the reviewed change without rewriting or squashing the contributor commit.

Test plan

  • bun test tests/openai-responses-passthrough.test.ts tests/management-provider-validation.test.ts tests/openai-api-virtual-models.test.ts tests/config.test.ts — 228 passed
  • bun run typecheck

Decision Log

  • Purpose: land the validated hosted-tool behavior while preserving contributor attribution.
  • Constraint: fix: preserve hosted image tool preferences #616 is conflicting and maintainerCanModify is disabled.
  • Chosen approach: replay the original authored commit onto current dev, resolve only current-dev integration conflicts, and retain the original commit as the first commit in this PR.
  • Tradeoff: a small integration PR replaces direct merging of fix: preserve hosted image tool preferences #616, but avoids force-pushing a contributor branch and keeps history/auditability intact.

Supersedes #616 after merge.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Ingwannu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2ed87f3e-c5ca-4545-838d-b7bad11465af

📥 Commits

Reviewing files that changed from the base of the PR and between 2491f13 and 29e98c6.

📒 Files selected for processing (16)
  • docs-site/src/content/docs/ja/reference/configuration.md
  • docs-site/src/content/docs/ko/reference/configuration.md
  • docs-site/src/content/docs/reference/configuration.md
  • docs-site/src/content/docs/ru/reference/configuration.md
  • docs-site/src/content/docs/zh-cn/reference/configuration.md
  • src/adapters/openai-responses.ts
  • src/config.ts
  • src/providers/openai-virtual-models.ts
  • src/responses/hosted-tool-policy.ts
  • src/server/auth-cors.ts
  • src/types.ts
  • structure/04_transports-and-sidecars.md
  • tests/config.test.ts
  • tests/management-provider-validation.test.ts
  • tests/openai-api-virtual-models.test.ts
  • tests/openai-responses-passthrough.test.ts

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

@github-actions github-actions Bot added the bug Something isn't working label Aug 1, 2026

@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: 29e98c6706

ℹ️ 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 src/config.ts
return `${field}.${key} cannot prefer ${tool}: the model does not support it`;
}
}
let effectiveWire = resolveEffectiveWire(key, registry?.adapter ?? provider.adapter);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor registry model-wire defaults during validation

For deepseek/deepseek-v4-flash on a Responses inbound request, the canonical registry declares an openai-responses model-wire default and resolveWireProtocolOverride selects it at runtime, but this validator initializes effectiveWire from the provider-wide registry.adapter (openai-chat) and never consults providerModelWireDefault. Consequently, both config loading and the management API reject a hosted-tool preference that would actually execute through the required Responses adapter; derive the effective wire through the same inbound-aware registry path used by the runtime.

AGENTS.md reference: src/AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

Comment on lines +640 to +642
const preferredTools = (selectedModelId ? provider.modelPreferHostedTools?.[selectedModelId] : undefined)
?? provider.modelPreferHostedTools?.[modelId];
if (!preferredTools?.includes(HOSTED_IMAGE_GENERATION_TOOL) || !isPlainObject(body)) return body;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict preference lookup to own array entries

When modelPreferHostedTools is present and a request routes to a valid model ID matching an inherited Object.prototype property, such as constructor or toString, this lookup returns the inherited function rather than an array and the subsequent .includes(...) call throws a TypeError before upstream dispatch. Model IDs with these values are accepted by routing, so use an own-property lookup and verify that the selected entry is an array before reading it.

AGENTS.md reference: src/AGENTS.md:L17-L17

Useful? React with 👍 / 👎.

@Ingwannu

Ingwannu commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

Integration is now green on Ubuntu, macOS, Windows, all three npm-global jobs, React Doctor, and the target gate. The original contributor commit remains intact as the first commit. @lidge-jun @Wibias, ready for the independent maintainer approval required before merge.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants