Skip to content

fix(responses): strip search_content_types on web_search for Muse Spark - #2617

Closed
DevonGithub wants to merge 1 commit into
lidge-jun:devfrom
DevonGithub:fix/muse-spark-websearch
Closed

DevonGithub wants to merge 1 commit into
lidge-jun:devfrom
DevonGithub:fix/muse-spark-websearch

Conversation

@DevonGithub

@DevonGithub DevonGithub commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

opencode-go/muse-spark-1.2-contributor fails when routed through the Codex app / opencodex proxy. It is the only model on the opencode-go key that breaks; gpt-5.6-luna and deepseek-v4-flash work on the same key.

Root cause

Muse Spark only serves over the Responses API (POST /v1/responses). A direct test of POST /v1/chat/completions for this model returns 500 Internal server error even with no tools. The opencodex registry had never routed Muse to Responses; only gpt-5.6-luna was in modelWireDefaults.

Additionally, once a client (Codex) sends a web_search tool carrying search_content_types, Muse's gateway rejects the whole request with:

400 invalid_request_error tools[].search_content_types is only supported for web_search_preview tools

Gateway probe results (direct, 2026-08-26) on Muse over /v1/responses:

Tool Field Result
web_search (plain) 200
web_search search_content_types 400
web_search search_context_size 200
web_search external_web_access 200
web_search filters: {} 200
web_search user_location 200
web_search_preview every field incl search_content_types 200

So the only rejected combination is search_content_types on a plain web_search tool, and only for Muse. Luna accepts every shape.

Fix

  1. src/adapters/openai-responses.ts - added stripMuseSparkUnsupportedWebSearchFields, which removes search_content_types from web_search tools for the exact model muse-spark-1.2-contributor only. It runs on the routed Responses path alongside the existing OpenAI-only web-search cleanup, and does not touch web_search_preview or any other field.
  2. src/providers/registry.ts - added muse-spark-1.2-contributor to opencode-go modelWireDefaults as openai-responses, mirroring the existing gpt-5.6-luna entry.

Tests

Added stripMuseSparkUnsupportedWebSearchFields coverage in tests/responses-routed-web-search-fields.test.ts (all pass):

  • strips search_content_types from web_search for the exact Muse model
  • keeps web_search_preview untouched
  • strips nested additional_tools
  • leaves a non-Muse model unchanged
  • ignores a near-match model id

Also verified manually: Muse now returns 200 over /v1/responses with the offending tool; gpt-5.6-luna and deepseek-v4-flash still return 200.

Note

This does not change how other models route. Explicit user modelAdapters entries still take precedence (same contract as the existing Luna routing).

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • missing_regression_test — Behavior changed under src/ or gui/src/ without a test change. Add focused coverage or obtain test-exception-approved.

@github-actions github-actions Bot added intake: hygiene-blocked Deterministic PR hygiene checks failed bug Something isn't working labels Aug 25, 2026
@coderabbitai

coderabbitai Bot commented Aug 25, 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 89efaffd-7e63-45c2-8fe6-0af195a9b61a

📥 Commits

Reviewing files that changed from the base of the PR and between ec51e42 and 815f555.

📒 Files selected for processing (2)
  • src/adapters/openai-responses.ts
  • src/providers/registry.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change routes muse-spark-1.2-contributor through the OpenAI Responses wire and removes its unsupported search_content_types field from plain web-search tools in routed requests.

Changes

Muse Spark Responses support

Layer / File(s) Summary
Wire routing
src/providers/registry.ts
At line 1346, opencode-go defaults muse-spark-1.2-contributor to the openai-responses wire. Explicit modelAdapters entries remain higher priority.
Request sanitization
src/adapters/openai-responses.ts
Lines 1558–1607 add model-specific removal of search_content_types from top-level tools and nested additional_tools items. Line 1820 invokes the helper in the non-canonical routed request path.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 815f5

The PR localizes Muse Spark Responses routing and web-search compatibility changes. The only remaining follow-up is to confirm or remove the gateway probe date; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant ProviderRegistry
  participant buildRequest
  participant WebSearchSanitizer
  participant ResponsesEndpoint
  ProviderRegistry->>buildRequest: Route Muse Spark to openai-responses
  buildRequest->>WebSearchSanitizer: Sanitize routed request body
  WebSearchSanitizer-->>buildRequest: Remove search_content_types
  buildRequest->>ResponsesEndpoint: Send sanitized request
Loading

Suggested reviewers: ingwannu

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 describes the primary compatibility fix: removing the unsupported search_content_types field from web_search tools for Muse Spark. It does not mention the Responses API routing chang…
Full details: Title check

Explanation

The title clearly describes the primary compatibility fix: removing the unsupported search_content_types field from web_search tools for Muse Spark. It does not mention the Responses API routing change, but the title need not cover every change.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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.

@github-actions github-actions Bot changed the title fix(responses): strip search_content_types on web_search for Muse Spark [WRONG BRANCH] fix(responses): strip search_content_types on web_search for Muse Spark Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ⬜ I pushed my PR to the latest dev commit.
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

Hygiene

✅ Deterministic PR hygiene checks passed.

@github-actions
github-actions Bot marked this pull request as draft August 25, 2026 20:23
Muse Spark (muse-spark-1.2-contributor) only serves over the Responses API. Its
gateway rejects `search_content_types` on a plain `web_search` tool (400) while
accepting it on `web_search_preview`, and accepts every other web_search field on
both tool types (probed directly against the gateway 2026-08-26). Only Muse is
affected; gpt-5.6-luna and deepseek-v4-flash are not.

- Strip search_content_types from web_search tools for the exact Muse model only.
- Route Muse to the same openai-responses wire default as gpt-5.6-luna.
- Add regression coverage for the exact model match, web_search_preview retention,
  nested additional_tools, non-Muse, and near-match model ids.
@DevonGithub
DevonGithub force-pushed the fix/muse-spark-websearch branch from 815f555 to 41f2d65 Compare August 25, 2026 20:38
@DevonGithub
DevonGithub changed the base branch from main to dev August 25, 2026 20:39
@github-actions github-actions Bot changed the title [WRONG BRANCH] fix(responses): strip search_content_types on web_search for Muse Spark fix(responses): strip search_content_types on web_search for Muse Spark Aug 25, 2026
lidge-jun added a commit that referenced this pull request Aug 25, 2026
…rk (#2617) (#2621)

* release: v2.32.1

* release: v2.33.0

* fix(responses): strip search_content_types on web_search for Muse Spark

Muse Spark (muse-spark-1.2-contributor) only serves over the Responses API. Its
gateway rejects search_content_types on a plain web_search tool (400) but
accepts it on web_search_preview and accepts every other web_search field on
both tool types (probed directly 2026-08-26). Only Muse is affected; Luna and
DeepSeek are not.

- Strip search_content_types from web_search for Muse only.
- Route Muse to the same openai-responses default as gpt-5.6-luna.

* fix(responses): strip search_content_types on web_search for Muse Spark (#2617)

Carries DevonGithub's change onto dev with the test it needs, minus an
unrelated version bump.

Three changes to what was submitted:
- dropped the package.json 2.32.1-preview -> 2.33.0 bump. Versioning is the
  release train's, not a bug fix's.
- added tests/muse-spark-web-search-compat.test.ts. This touches a shared
  adapter and the provider registry; without a test neither the model-scoped
  field removal nor the Responses wire default is protected.
- updated the registry decision log, which still described the map as
  Luna-only after gaining a second entry.

Falsified: removing the sanitizer call reddens the plain-web_search and
nested additional_tools cases and nothing else.

---------

Co-authored-by: DevonGithub <DevonGithub@users.noreply.github.com>
@lidge-jun

Copy link
Copy Markdown
Owner

Landed on dev as #2621, with a regression test and two adjustments.

The mechanism is right, and the reasoning holds up independently: the field comes from Codex's own hosted_spec.rs (web_search_tool_type: TextAndImage), and Codex already handles the same incompatibility class for Bedrock by selecting text-only search. Dropping exactly the refused field at the adapter boundary is a compatibility guard, not a symptom patch.

Three things I changed:

  • Branch. This targeted main, which only moves by maintainer promotion — your own title flagged it. Rebased onto dev.
  • Version bump removed. The diff also took package.json from 2.32.1-preview.20260825 to 2.33.0. Versioning belongs to the release train; a web-search fix should not move the release surface as a side effect.
  • Test added. This touches a shared adapter and the provider registry with no test, so neither the model-scoped removal nor the new Responses wire default was protected. The new test pins that web_search_preview keeps the field, that other models on the same provider are untouched, that nested additional_tools is sanitized too, and that the registry map stays an exact-model allowlist.

I also refreshed the registry decision log, which still described modelWireDefaults as Luna-only after gaining a second entry.

One thing I could not confirm: your live 200/400 matrix. The account available here now gets 403 … requires explicit opt in for every Muse request, so the rejection could not be re-probed. That does not block the change — it is scoped to one exact model and removes one field — but it is worth stating rather than implying I verified it.

Thanks for finding this. Closing in favour of the merged PR.

@lidge-jun lidge-jun closed this Aug 25, 2026
@lidge-jun

Copy link
Copy Markdown
Owner

Landed via #2621 at 1a15d62

@lidge-jun lidge-jun added the landed-via-maintainer Original PR closed after landing via a maintainer merge train label Aug 25, 2026
@github-actions github-actions Bot removed the intake: hygiene-blocked Deterministic PR hygiene checks failed label Aug 25, 2026
tarunravi pushed a commit to tarunravi/opencodex that referenced this pull request Sep 14, 2026
…rk (lidge-jun#2617) (lidge-jun#2621)

* release: v2.32.1

* release: v2.33.0

* fix(responses): strip search_content_types on web_search for Muse Spark

Muse Spark (muse-spark-1.2-contributor) only serves over the Responses API. Its
gateway rejects search_content_types on a plain web_search tool (400) but
accepts it on web_search_preview and accepts every other web_search field on
both tool types (probed directly 2026-08-26). Only Muse is affected; Luna and
DeepSeek are not.

- Strip search_content_types from web_search for Muse only.
- Route Muse to the same openai-responses default as gpt-5.6-luna.

* fix(responses): strip search_content_types on web_search for Muse Spark (lidge-jun#2617)

Carries DevonGithub's change onto dev with the test it needs, minus an
unrelated version bump.

Three changes to what was submitted:
- dropped the package.json 2.32.1-preview -> 2.33.0 bump. Versioning is the
  release train's, not a bug fix's.
- added tests/muse-spark-web-search-compat.test.ts. This touches a shared
  adapter and the provider registry; without a test neither the model-scoped
  field removal nor the Responses wire default is protected.
- updated the registry decision log, which still described the map as
  Luna-only after gaining a second entry.

Falsified: removing the sanitizer call reddens the plain-web_search and
nested additional_tools cases and nothing else.

---------

Co-authored-by: DevonGithub <DevonGithub@users.noreply.github.com>
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
…rk (lidge-jun#2617) (lidge-jun#2621)

* release: v2.32.1

* release: v2.33.0

* fix(responses): strip search_content_types on web_search for Muse Spark

Muse Spark (muse-spark-1.2-contributor) only serves over the Responses API. Its
gateway rejects search_content_types on a plain web_search tool (400) but
accepts it on web_search_preview and accepts every other web_search field on
both tool types (probed directly 2026-08-26). Only Muse is affected; Luna and
DeepSeek are not.

- Strip search_content_types from web_search for Muse only.
- Route Muse to the same openai-responses default as gpt-5.6-luna.

* fix(responses): strip search_content_types on web_search for Muse Spark (lidge-jun#2617)

Carries DevonGithub's change onto dev with the test it needs, minus an
unrelated version bump.

Three changes to what was submitted:
- dropped the package.json 2.32.1-preview -> 2.33.0 bump. Versioning is the
  release train's, not a bug fix's.
- added tests/muse-spark-web-search-compat.test.ts. This touches a shared
  adapter and the provider registry; without a test neither the model-scoped
  field removal nor the Responses wire default is protected.
- updated the registry decision log, which still described the map as
  Luna-only after gaining a second entry.

Falsified: removing the sanitizer call reddens the plain-web_search and
nested additional_tools cases and nothing else.

---------

Co-authored-by: DevonGithub <DevonGithub@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working landed-via-maintainer Original PR closed after landing via a maintainer merge train

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants