You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4e79b56
Browse filesBrowse the repository at this point in the historyBrowse files
fix(web-search): bind the passthrough bridge search model to its backend
sidecarSettingsForBridge read the model out of the global config.webSearchSidecar
block without checking which backend that block was configured for, and
src/server/responses/core.ts hands the block over whole. A global
{backend: "openai", model: "gpt-5.6-luna"} therefore reached runAnthropicWebSearch
whenever a provider set webSearchBridge.backend to "anthropic", and Anthropic
rejects the model, so the bridge search failed. Same shape for xai and gemini.
The global model now applies only when resolveSidecarBackend(sidecar.backend)
equals the bridge backend; otherwise the bridge runs that backend's own default.
An unset global backend still resolves to "openai", so an unset-backend model
reaches an openai bridge and no other. Only the model is gated: reasoning is a
generic effort level, and xSearch is xai-only with no per-backend default and no
webSearchBridge equivalent, so gating it would make an openai sidecar plus an xai
bridge plus x_search inexpressible.
No credential crosses a backend, before or after this change.
resolvePassthroughWebSearchBridgeAuth switches on the bridge backend and consults
only that backend's credential locator. This is a model and settings defect.
resolveSidecarBackend and WebSearchBackendId move from src/web-search/index.ts to
src/web-search/sidecar-providers.ts, which exists precisely so the bridge can
resolve a backend without value-importing the barrel; index.ts re-exports both, so
every existing consumer is unchanged.
Copy file name to clipboardExpand all lines: docs-site/src/content/docs/reference/configuration/providers.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,7 +201,7 @@ Providers can expose a built-in shorthand, such as `agy` for `google-antigravity
201
201
|`terminalContinuationGuard?`|`boolean`| Opt in an `openai-chat` provider to one bounded internal re-ask when an actionable turn announces work, then cleanly stops without a tool call. Defaults to `false`; explicit `false` behaves like omission. Combo attempts and routed compaction turns are excluded, and non-`openai-chat` adapters ignore this option. |
202
202
|`responsesItemIdRepair?`|`{ message?: string[]; reasoning?: string[]; repairMissingTerminalIds?: boolean; repairInvalidIds?: boolean }`| Disabled-by-default downstream SSE repair for exact placeholder ids, missing terminal ids, and (with `repairInvalidIds`) message/reasoning ids missing the canonical `msg_`/`rs_` prefix. Function-call ids are never rewritten. Built-in DeepSeek enables the last two by default. |
203
203
|`responsesSnapshotRepair?`|`boolean`| Disabled-by-default client-facing repair for sparse Responses lifecycle snapshots in SSE and JSON. Fills missing canonical status, output, and tool metadata while raw inspection and persistence remain unchanged. |
204
-
| `webSearchBridge?` | `{ enabled?: boolean; backend?: "ollama" \| "openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"; maxSearches?: number; timeoutMs?: number; endpoint?: string }` | Key-auth `openai-responses` passthrough providers only. Off by default. Codex always declares the hosted `web_search` tool, and the passthrough relays it on the assumption the destination executes it. A gateway that does not run hosted search answers with a `function_call` named `web_search` that nothing runs, and the undeclared-tool guard ends the turn. With `enabled: true` and an explicit `backend` OpenCodex intercepts that call, runs the search itself, feeds the result back to the same upstream, and shows Codex a hosted `web_search_call` cell. Never armed for `authMode: "forward"` (ChatGPT already searches) or for a provider that executes hosted search upstream. `backend` is required; there is no implicit default and a missing credential for the named backend leaves the bridge disarmed rather than falling through to another paid search. `ollama` reuses this provider's own API key on `POST <origin>/api/web_search`, so the origin must be `https://ollama.com` unless the operator names `endpoint` explicitly. `openai` / `anthropic` / `xai` / `gemini` / `exa` reuse the matching sidecar executor and that executor's own credential (`webSearchSidecar.exaApiKey` for Exa). Streaming turns only. A turn that mixes `web_search` with another client tool call still fails closed rather than dropping the client's call. Assistant text such as XML-like `<web_search>` prose is not executed. Defaults: `maxSearches: 3` (1..10), `timeoutMs: 60000` (1000..600000). |
204
+
| `webSearchBridge?` | `{ enabled?: boolean; backend?: "ollama" \| "openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"; maxSearches?: number; timeoutMs?: number; endpoint?: string }` | Key-auth `openai-responses` passthrough providers only. Off by default. Codex always declares the hosted `web_search` tool, and the passthrough relays it on the assumption the destination executes it. A gateway that does not run hosted search answers with a `function_call` named `web_search` that nothing runs, and the undeclared-tool guard ends the turn. With `enabled: true` and an explicit `backend` OpenCodex intercepts that call, runs the search itself, feeds the result back to the same upstream, and shows Codex a hosted `web_search_call` cell. Never armed for `authMode: "forward"` (ChatGPT already searches) or for a provider that executes hosted search upstream. `backend` is required; there is no implicit default and a missing credential for the named backend leaves the bridge disarmed rather than falling through to another paid search. `ollama` reuses this provider's own API key on `POST <origin>/api/web_search`, so the origin must be `https://ollama.com` unless the operator names `endpoint` explicitly. `openai` / `anthropic` / `xai` / `gemini` / `exa` reuse the matching sidecar executor and that executor's own credential (`webSearchSidecar.exaApiKey` for Exa). The search model comes from `webSearchSidecar.model` only when `webSearchSidecar.backend` resolves to the same backend this bridge names; otherwise the bridge runs that backend's own default, because a model chosen for one vendor is rejected by another. An unset `webSearchSidecar.backend` resolves to `openai`, so an unset-backend model reaches an `openai` bridge and no other. There is no per-provider bridge model override. Streaming turns only. A turn that mixes `web_search` with another client tool call still fails closed rather than dropping the client's call. Assistant text such as XML-like `<web_search>` prose is not executed. Defaults: `maxSearches: 3` (1..10), `timeoutMs: 60000` (1000..600000). |
205
205
| `retryOn429?` | `{ enabled?: boolean; attempts?: number; intervalMs?: number; maxIntervalMs?: number; respectRetryAfter?: boolean }` | API-key providers only (`authMode: "key"`). Opt-in same-target 429 retry: when `retryOn429` is absent the feature is off; object presence enables it unless `enabled: false`. On 429 the proxy waits (upstream `Retry-After` or the fixed interval) and replays the identical request on the same key before any key failover — across the main text-turn recovery loop, the Responses passthrough wire, the image/video bridge, the web-search sidecar, and terminal continuations. Only pre-stream HTTP 429 responses are eligible for replay; custom `runTurn` transports are outside the HTTP retry loop. `attempts` counts same-key replays after the first 429 (total sends = `attempts` + 1) and is one request-wide budget shared by the main recovery loop, the terminal-guard continuation, and bridge retries. Exhausting `attempts` only stops further same-key replays: normal key failover or final-error handling then applies per the available targets — on the key-auth passthrough wire there is no failover, so the exhausted 429 surfaces as-is. Codex itself never retries 429, so this is the only defense for single-key providers. Defaults: `enabled: true`, `attempts: 3`, `intervalMs: 5000`, `maxIntervalMs: 60000` (any single wait is capped at `maxIntervalMs`, itself capped at 600000), `respectRetryAfter: true`. |
206
206
|`transientRetryOn5xx?`|`{ enabled?: boolean; attempts?: number }`| Key-auth `openai-chat` providers only. Opt-in retry for pre-stream transient upstream statuses (500, 502, 503, 504, 520, 521, 522): absent means off, object presence enables it unless `enabled: false`. Covers the initial Responses request, the terminal-guard continuation, and native `/v1/chat/completions`. `attempts` is the TOTAL number of upstream sends allowed for one request including the first (1..10, default 3) — it is one budget shared with connection-reset recovery, so `3` means at most three real requests reach the provider. Waits use a fixed 400 ms exponential backoff capped at 5 s and honor `Retry-After`. Separate from `retryOn429`, which handles rate limiting; mid-stream failures are never replayed. |
207
207
|`autoToolChoiceOnlyModels?`|`string[]`| Models whose `tool_choice` accepts only `auto` or `none`; forced choices are downgraded. |
Copy file name to clipboardExpand all lines: structure/runtime.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,6 +246,21 @@ disarmed rather than falling through to another paid search. A leg that mixes an
246
246
`web_search` call with another client-executed tool still fails closed. Assistant text is not
247
247
treated as a search instruction.
248
248
249
+
The bridge backend and the global `webSearchSidecar` block are configured independently, so the
250
+
sidecar's `model` applies to a bridge search only when `resolveSidecarBackend(webSearchSidecar.backend)`
251
+
equals that bridge backend; otherwise the bridge runs the backend's own default. An unset global
252
+
backend resolves to `openai`, so an unset-backend model reaches an `openai` bridge and no other.
253
+
There is no per-provider `webSearchBridge.model`, so a mismatched backend gets the default rather
254
+
than a vendor-specific override. This is a model and settings rule, not a credential one:
255
+
`resolvePassthroughWebSearchBridgeAuth` switches on the bridge backend and consults only that
256
+
backend's credential locator, so no key crosses backends. `reasoning` and `xSearch` are not gated —
257
+
`reasoning` is a generic effort level and `xSearch` is xai-only with no per-backend default and no
258
+
`webSearchBridge` equivalent. `resolveSidecarBackend` lives in `src/web-search/sidecar-providers.ts`
259
+
rather than the `src/web-search/index.ts` barrel so the bridge can answer this question without a
260
+
value import of the barrel; the barrel re-exports it.
261
+
`tests/web-search/web-search-passthrough-bridge.test.ts` covers the mismatch and matching cases for
262
+
anthropic, xai, and gemini, plus the unset-backend default.
263
+
249
264
## Remote Hub hardening ownership
250
265
251
266
`src/remote/protocol.ts` owns pure interval/feature negotiation. `src/remote/hub-state.ts` owns the `GET|HEAD /v1/hub-state` contract, its caps, and the parser both sides share. `src/client/hub-client.ts` owns bounded, schema-validated remote catalog consumption, hub-state reads, and key-id probes; `src/client/hub-state.ts` owns the resolution and the owner-stamped 0600 cache, and a failed read reports "unavailable" rather than degrading to the client's own local provider and login state. `src/client/hub-relay.ts` is a fixed-authority management relay with URL, header, body, redirect, and stream bounds. The public data listener remains the direct client→hub path; the loopback management ingress never serves data-plane routes.
0 commit comments