Repository navigation
Description
Client or integration
Codex App and direct HTTP client
Provider or upstream service
IkunCode OpenAI-compatible Responses endpoint, https://api.ikuncode.cc/v1/responses. Tested model IDs: gemini-4-argon and gemini-3.8-flash.
OpenCodex version
2.97.0 on macOS; source base tag v2.97.0.
Endpoint or capability
Responses hosted web_search_preview / web_search declarations combined with ordinary client function/custom tools, including namespace and client-loaded tool catalogs.
Current behaviour
The existing unsupportedHostedTools: ["web_search"] is an effective workaround for mixed-tool requests, but also removes the search-only capability that the upstream actually accepts.
Synthetic direct tests on both model IDs, 2026-11-06:
| Declared tools | Result |
|---|---|
| ordinary function only | 200, completed |
| hosted search only | 200, completed |
| hosted search + ordinary function | 400, error below |
mixed tools + top-level tool_config.include_server_side_tool_invocations=true |
same 400 |
A separate search-only request through the locally patched gateway actually emitted response.web_search_call.in_progress, searching, completed, a completed web_search_call item and URL citations. This is more than a declaration-only success.
These tests establish this endpoint's observed contract. They do not establish whether the mixed-tool limitation originates in IkunCode's conversion or Google's serving stack, and do not verify the underlying model identity.
Expected behaviour
Allow a provider to describe a conditional incompatibility: omit a named hosted declaration only when client function/custom tools are also present. Preserve standalone hosted search, preserve ordinary tools, reconcile selectors and client-loaded catalogs, and retain undeclared-tool validation. Do not silently change unrelated providers.
Minimal redacted request or reproduction
Use an existing key for the intended provider. All content below is synthetic.
curl https://api.ikuncode.cc/v1/responses \
-H "Authorization: Bearer $IKUNCODE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-4-argon",
"input": "Synthetic test. Do not search or call tools. Reply exactly OK.",
"stream": true,
"tools": [
{"type": "web_search_preview"},
{
"type": "function",
"name": "lookup_marker",
"description": "Read a synthetic diagnostic marker.",
"parameters": {
"type": "object",
"properties": {"marker": {"type": "string"}},
"required": ["marker"],
"additionalProperties": false
}
}
]
}'Remove either tool declaration: both isolated variants complete. Replace the model ID with gemini-3.8-flash: the same matrix reproduces. Adding the requested flag at the Responses top level did not change the observed mixed-tool 400.
Actual response or error
{
"error": {
"message": "Please enable tool_config.include_server_side_tool_invocations to use Built-in tools with Function calling.",
"type": "upstream_error",
"param": "",
"code": 400
}
}Upstream documentation
Provider metadata: https://api.ikuncode.cc/api/pricing lists the tested model IDs with Gemini and OpenAI endpoint types. It does not document this mixed-tool restriction.
Google's referenced tool-combination documentation: https://ai.google.dev/gemini-api/docs/generate-content/tool-combination . The compatibility claim here is based on the concrete synthetic matrix above, not an assumption that every OpenAI-compatible Responses gateway forwards Google's tool_config fields.
Suggested mapping or implementation notes
A tested local implementation adds an opt-in provider field:
{
"adapter": "openai-responses",
"unsupportedHostedToolsWithFunctions": ["web_search"]
}The existing unconditional unsupportedHostedTools remains authoritative and unchanged. The new conditional policy:
- detects function/custom tools or populated namespaces in root and
additional_toolscatalogs; - expands hosted aliases through the existing policy helper;
- reuses the existing filtering and selector reconciliation;
- validates a closed hosted-tool vocabulary at config and management boundaries;
- survives same-destination provider saves, is returned by provider GET, and supports PATCH clearing;
- does not alter the undeclared-tool guard or grant Bash/other tools.
Core change in stripUnsupportedHostedTools:
const conditional = provider.unsupportedHostedToolsWithFunctions;
const catalogs = conditional?.length
? [body.tools, ...(Array.isArray(body.input) ? body.input.flatMap(item =>
isPlainObject(item) && item.type === "additional_tools" ? [item.tools] : []) : [])]
: [];
const hasFunctions = catalogs.some(tools => Array.isArray(tools) && tools.some(tool =>
isPlainObject(tool) && (tool.type === "function" || tool.type === "custom"
|| (tool.type === "namespace" && Array.isArray(tool.tools) && tool.tools.length > 0))));
const declaredUnsupported = declaredUnsupportedHostedTools(hasFunctions
? { unsupportedHostedTools: [...(provider.unsupportedHostedTools ?? []), ...conditional!] }
: provider);A narrower provider capability is preferable to hard-coding IkunCode's URL. An upstream mixed-tool fix could later make even this opt-in unnecessary.
Additional context and attachments
Related mechanism: #5002. This request is specifically conditional filtering rather than a second unconditional deny list.
Local validation:
- 38 hosted-tool declaration tests passed, including new mixed/root/loaded/alias cases.
- 38 management carry-over and reset-policy tests passed.
- 168 undeclared-tool/inbound/model-rename tests passed.
- Typecheck passed for 2,305 source files.
- Privacy scan passed; docs build passed (641 pages).
- The broad import-graph changed-test run was interrupted after several minutes without a completed selection/result; it is not reported as passing. No full-suite result is claimed.
- Isolated and production synthetic requests passed after the local patch: mixed tool declarations, namespace custom-tool call and result continuation, and standalone hosted search with actual search events.
- Official OpenAI connectivity was checked separately; this change does not change provider/network routing.
A separate intermittent pre-output EOF/long wait has also been observed. This conditional-filtering patch is not claimed to fix all Gemini disconnects.
Checks
- I searched existing provider and compatibility issues.
- The request and response were redacted.
- The expected behaviour is based on an upstream specification or a concrete client requirement.
Activity
github-actions commentedon Nov 6, 2026
Automated translation bookkeeping — detected language: English.
LynchLiu-Lingqing commentedon Nov 6, 2026
Follow-up: six-path review and two distinct failure classes (2026-11-06)
Related timeout-contract reproduction: #8206. The following is a consolidated, synthetic-only test summary. No project files, private conversation text, or credentials are included.
Six-path Gemini 4 Argon control
Same seeded reference (about 20k input tokens), one ordinary function declaration, low effort, the same short marker, one cold call and one identical repeat per path. Each path used its own stable prefix to avoid cross-path cache prewarming. Cold order was reversed for the repeat. The CLI workload was paused before this final matrix.
All 12 controls completed. This small matrix is not a long-run reliability ranking. Every repeat was slower despite about 90% cache reuse, so cache accounting is not a latency guarantee. The higher cached fraction on one gateway path reflects additional prompt tokens, not fewer uncached tokens: all six repeats had exactly 2,049 uncached tokens.
Flash was also tested across all six paths. Repeated 20k-input requests reported roughly 79–80% cache reuse. Both Chat and Responses passed custom tools, namespaces, and synthetic tool-result images. The local Flash per-model adapter was changed to Responses after testing, preserving its prior visibility/window settings. No higher cache discount is claimed from that adapter change.
Context length versus long tool arguments
A separate Gemini 4 control carried seven synthetic function-call/result pairs and about 142k input tokens:
In contrast, a short prompt requiring one function call containing 600 long synthetic row strings behaved as follows:
streamGenerateContent?alt=sse: PINGcomments about 60 s apart; no argument delta or terminal before the diagnostic client's explicit 220 s deadlineFor Chat, the first nonempty tool-argument bytes arrived at 184.133 s, essentially at completion. The provider therefore kept the connection alive but did not progressively deliver those long arguments in this sample.
Reducing that same payload to 100 rows through OpenCodex → Responses completed in 35.480 s, produced 4,018 output tokens, and all 100 rows matched the expected sequence. This supports bounded tool-output generation as a practical mitigation; a single sample is not a universal safe threshold.
The Responses 220 s result is a client-bounded test timeout, not an upstream 220 s limit or proof the origin would never finish. Failed/unfinished calls reported no usage; their actual billing is unverified.
Two historical session errors should not be conflated
Session A used the translated Chat route. Its visible error explicitly said the completion was empty and the single OpenCodex retry was empty again. Records show
sendCount: 2,recoveryKinds: ["empty-completion"], and zero output. For example, 619,668 input tokens in that record are the sum of two sends of the same request (about 309,834 per send), not one 619k request. Cache reads could be very high even on this failure. The normalized local 502, and even a coarseterminalSourcefield, must not be treated as captured proof of an original upstream HTTP 502. Historical raw upstream SSE was not retained, so the exact source of those empty responses remains unproven.Session B was confirmed to be on native Responses even though its old UI label still said Chat. Its last successful request used 133,926 input tokens and completed in 8.999 s. The following tool result was about 10.7k characters; the next request ended after 303.756 s with
adapter_eof, no reported usage, stageprotocol-prelude, and one physical send. This is not the same empty-completion-retry failure. The new controls show that neither about 140k input nor passage through OpenCodex alone is sufficient to reproduce it.The separate local fixture in #8206 demonstrates why matching that duration to a configured 300 s stall budget is not enough to blame the local clock: an explicit 1 s budget did not stop native Responses SSE after 4.5 s, while the translated Chat path failed near 1 s.
Current local choice and upstream work requested
The local desktop path remains Codex → OpenCodex → IkunCode Responses for daily Gemini use, based on native tool/event preservation and reduced conversion, not a claim that it is always fastest. The conditional hosted-tool patch in this issue is deployed and its ordinary-tool/search-only cases pass. Undeclared-tool validation stays enabled. Context/compaction settings were not lowered as a workaround for these failures.
Large file/tool payloads should be generated in shorter scripts or several patches with checkpoints. No automatic cross-model continuation or unlimited resend was added.
For the provider-facing side, the useful checks are:
Google's current streaming documentation describes incremental function arguments for its Interactions API; that does not establish that this provider's legacy GenerateContent endpoint or OpenAI-compatible bridge uses it: https://ai.google.dev/gemini-api/docs/streaming .
For OpenCodex, the bounded, credential-safe observability needed is first/last upstream byte time, semantic-output time, terminal presence, and close kind. A healthy status endpoint or periodic PING must not be presented as successful model output.
The historical 304 s failure has not been claimed fully resolved or uniquely assigned to a vendor. The direct 524 and the local timeout-contract inconsistency are separately reproduced evidence.
Ingwannu commentedon Nov 7, 2026
Thanks for the matrix. On
dev(aaa3c20f3f) the only hosted-tool filter is unconditional:stripUnsupportedHostedTools(src/adapters/openai-responses/tool-schema.ts:250) appliesprovider.unsupportedHostedToolsviadeclaredUnsupportedHostedTools(src/responses/hosted-tool-policy.ts:75-77) regardless of which other tools are declared. There is no "only when function/custom tools are present" form, sounsupportedHostedTools: ["web_search"]remains the supported workaround at the cost of standalone search.The 400 itself is an upstream gateway limitation (it asks for Gemini's
tool_config.include_server_side_tool_invocations, which the endpoint did not honor at the Responses top level in your test), not an OpenCodex translation fault. A conditional filter would be a new persisted provider field touching config schema, management validation/carry-over and docs, so whether to add it is an owner decision; if accepted, the shape you outline (reuse the existing alias expansion and selector reconciliation, closed vocabulary, unconditional list stays authoritative) is the right scope.The timeout observations in the follow-up are tracked separately in #8206; please keep this issue to the conditional-filter request.
lidge-jun commentedon Nov 10, 2026
Rechecked on
devdf0e6ccc4: nothing has changed since the earlier comment.stripUnsupportedHostedToolsappliesprovider.unsupportedHostedToolsunconditionally, so this remains an owner decision about a new persisted provider field. The options:unsupportedHostedTools: ["web_search"]stays the documented workaround and also loses standalone search.unsupportedHostedToolsWithClientTools: ["web_search"]. It uses the same closed vocabulary and alias expansion, applies only when the request also declares function or custom tools (including namespace and client-loaded catalogs), and the unconditional list stays authoritative when both name a tool. It touches config schema, management validation and carry-over, selector reconciliation, and docs.Recommendation: 2, if the owner accepts the new field; otherwise 1 with a docs note naming this gateway behavior.
lidge-jun commentedon Nov 10, 2026
Decision: option 2. An opt-in
unsupportedHostedToolsWithClientToolslist, with the existingunsupportedHostedToolstaking precedence, covering config schema, management validation and carry-over, selector reconciliation, and docs.fix(providers): refuse to prefer a hosted tool the conditional list d…
feat(providers): strip named hosted tools only beside client tools (#…