Skip to content

Commit 19376f7

Browse files
committed
fix(sidecars): close reviewed backend-union blockers
Gate xAI-only Responses web_search field stripping through registry-enriched capability metadata so official OpenAI API-key requests preserve external_web_access and search_context_size. Add buildRequest regressions for both providers.\n\nAdvertise the five-value web-search backend union in agent and Claude CLI usage, document explicit-only xAI/Gemini/Exa behavior and write-only exaApiKey, and synchronize localized accepted-value tables.\n\nExtend shared string-framing redaction for exaApiKey and cover JSON, colon, and query canaries.\n\nEvidence: 80 adapter tests, 42 redaction tests, 37 registry tests, 47 CLI tests; tsc, privacy scan, and 393-page docs build green.
1 parent a05f23f commit 19376f7

17 files changed

Lines changed: 109 additions & 23 deletions

File tree

‎docs-site/src/content/docs/fr/reference/configuration/server.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ l'API Images d'OpenAI et la forme de réponse attendue par Codex.
209209
| Champ | Type | Par défaut | Signification |
210210
| --- | --- | --- | --- |
211211
| `enabled?` | `boolean` | activé lorsqu'il est utilisable | Interrupteur principal. |
212-
| `backend?` | `"openai" \| "anthropic"` | automatique | Une valeur explicite est prioritaire ; sinon, la présence d'identifiants OAuth Anthropic stockés et utilisables sélectionne `anthropic`, puis `openai`. |
212+
| `backend?` | `"openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"` | `openai` | Une valeur explicite est prioritaire ; sans valeur, `openai` est toujours utilisé. `xai`, `gemini` et `exa` ne s'activent que s'ils sont configurés explicitement. |
213213
| `model?` | `string` | dépendant du backend | `gpt-5.6-luna` pour OpenAI ou `claude-sonnet-5` pour Anthropic. L'héritage explicite `gpt-5.4-mini` migre au démarrage. |
214214
| `reasoning?` | `string` | `low` | Effort secondaire. `minimal` est rejeté lors de la recherche sur le Web. |
215215
| `maxSearchesPerTurn?` | `number` | `3` | Recherches réelles autorisées par tour de modèle principal. |

‎docs-site/src/content/docs/ja/reference/configuration/server.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Codex は、タイトルやコミット メッセージなどのタスクに小
133133
|フィールド |タイプ |デフォルト |意味 |
134134
| --- | --- | --- | --- |
135135
| `enabled?` | `boolean` |使用可能な場合はオン |マスタースイッチ。 |
136-
| `backend?` | `"openai" \| "anthropic"` |自動 |明示的な勝利。それ以外の場合は使用可能な保存された Anthropic OAuth は `anthropic` を選択し、次に `openai` を選択します。 |
136+
| `backend?` | `"openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"` | `openai` |明示指定が優先され、未指定時は常に `openai` です。`xai`、`gemini`、`exa` は明示的に設定した場合のみ有効になります。 |
137137
| `model?` | `string` |バックエンド依存 | OpenAI の場合は `gpt-5.6-luna`、Anthropic の場合は `claude-sonnet-5`。従来の明示的な `gpt-5.4-mini` は開始時に移行されます。 |
138138
| `reasoning?` | `string` | `low` |サイドカーの取り組み。 `minimal` は Web 検索で拒否されます。 |
139139
| `maxSearchesPerTurn?` | `number` | `3` |メインモデルのターンごとに許可される実際の検索。 |

‎docs-site/src/content/docs/ko/reference/configuration/server.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Codex는 제목과 커밋 메시지 같은 작업에 작은 보조 모델을 사
133133
| 필드 | 형식 | 기본값 | 의미 |
134134
| --- | --- | --- | --- |
135135
| `enabled?` | `boolean` | on when usable | 주 스위치입니다. |
136-
| `backend?` | `"openai" \| "anthropic"` | auto | 명시값이 우선입니다. 그 외에는 사용 가능한 저장된 Anthropic OAuth가 있으면 `anthropic`을, 아니면 `openai`를 선택합니다. |
136+
| `backend?` | `"openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"` | `openai` | 명시값이 우선이며, 미설정 시 항상 `openai`입니다. `xai`, `gemini`, `exa`는 명시적으로 설정한 경우에만 활성화됩니다. |
137137
| `model?` | `string` | backend-dependent | OpenAI는 `gpt-5.6-luna`, Anthropic은 `claude-sonnet-5`입니다. 레거시로 명시된 `gpt-5.4-mini`는 시작 시 마이그레이션됩니다. |
138138
| `reasoning?` | `string` | `low` | 사이드카 노력 수준입니다. `minimal`은 web search와 함께 거부됩니다. |
139139
| `maxSearchesPerTurn?` | `number` | `3` | 메인 모델 턴당 허용되는 실제 검색 수입니다. |

‎docs-site/src/content/docs/reference/configuration/server.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,9 @@ Images API paths and response shape expected by Codex.
205205
| Field | Type | Default | Meaning |
206206
| --- | --- | --- | --- |
207207
| `enabled?` | `boolean` | on when usable | Master switch. |
208-
| `backend?` | `"openai" \| "anthropic"` | `openai` | Explicit wins; unset always resolves to `openai`. `anthropic` runs only when explicitly configured. |
209-
| `model?` | `string` | backend-dependent | `gpt-5.6-luna` for OpenAI or `claude-sonnet-5` for Anthropic. Legacy explicit `gpt-5.4-mini` migrates on start. |
208+
| `backend?` | `"openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"` | `openai` | Explicit wins; unset always resolves to `openai`. `xai`, `gemini`, and `exa` are explicit-only and remain inert unless configured. |
209+
| `model?` | `string` | backend-dependent | Sidecar model for model-backed search. Legacy explicit `gpt-5.4-mini` migrates on start. |
210+
| `exaApiKey?` | `string` | none | Operator key for the `exa` backend. Write-only: management reads never return the stored value. |
210211
| `reasoning?` | `string` | `low` | Sidecar effort. `minimal` is rejected with web search. |
211212
| `maxSearchesPerTurn?` | `number` | `3` | Real searches allowed per main-model turn. |
212213
| `routedModelStallTimeoutMs?` | `number` | `200000` | Config-file-only routed-model raw-body inactivity deadline. Integer 1–2147483647; every non-empty chunk resets it. |
@@ -216,7 +217,9 @@ The OpenAI backend requires a ChatGPT login and enabled ChatGPT `forward` provid
216217
routed replays inject main ChatGPT auth into the internal request. The Anthropic backend uses the
217218
active stored credential from an enabled Anthropic OAuth provider. An explicitly selected Anthropic
218219
backend with no usable account fails closed instead of falling back. The Anthropic executor uses its
219-
native `web_search_20250305` tool.
220+
native `web_search_20250305` tool. The `xai`, `gemini`, and `exa` lanes never activate from credential
221+
discovery or fallback; the operator must select them explicitly. `exaApiKey` is accepted on writes
222+
but omitted from management responses.
220223

221224
Four clocks govern search: base `stallTimeoutSec`, `connectTimeoutMs`, routed-model inactivity, and
222225
hosted-search timeout. The effective bridge watchdog is the maximum plus 30 seconds. Routed stall is

‎docs-site/src/content/docs/ru/reference/configuration/server.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Codex использует маленькие helper-model'и для задач
162162
| Поле | Тип | По умолчанию | Значение |
163163
| --- | --- | --- | --- |
164164
| `enabled?` | `boolean` | on when usable | Главный переключатель. |
165-
| `backend?` | `"openai" \| "anthropic"` | auto | Явный выбор выигрывает; иначе usable stored Anthropic OAuth выбирает `anthropic`, затем `openai`. |
165+
| `backend?` | `"openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"` | `openai` | Явный выбор имеет приоритет; без него всегда используется `openai`. `xai`, `gemini` и `exa` активируются только при явной настройке. |
166166
| `model?` | `string` | backend-dependent | `gpt-5.6-luna` для OpenAI или `claude-sonnet-5` для Anthropic. Старый явный `gpt-5.4-mini` мигрирует при старте. |
167167
| `reasoning?` | `string` | `low` | Effort sidecar'а. Значение `minimal` с web search отклоняется. |
168168
| `maxSearchesPerTurn?` | `number` | `3` | Число реальных поисков, разрешённых за один turn основной модели. |

‎docs-site/src/content/docs/tr/reference/configuration/server.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Images API yollarını ve yanıt şeklini uygulamalıdır.
232232
| Alan | Tip | Varsayılan | Anlamı |
233233
| --- | --- | --- | --- |
234234
| `enabled?` | `boolean` | kullanılabilir olduğunda açık | Ana anahtar. |
235-
| `backend?` | `"openai" \| "anthropic"` | auto | Açık olan kazanır; aksi takdirde kullanılabilir saklanan Anthropic OAuth `anthropic`'i, ardından `openai`'yi seçer. |
235+
| `backend?` | `"openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"` | `openai` | Açık seçim kazanır; ayarlanmadığında her zaman `openai` kullanılır. `xai`, `gemini` ve `exa` yalnızca açıkça yapılandırıldığında etkinleşir. |
236236
| `model?` | `string` | arka uca bağlı | OpenAI için `gpt-5.6-luna` veya Anthropic için `claude-sonnet-5`. Eski açık `gpt-5.4-mini` başlangıçta geçirilir. |
237237
| `reasoning?` | `string` | `low` | Sidecar çabası. `minimal` web araması ile reddedilir. |
238238
| `maxSearchesPerTurn?` | `number` | `3` | Ana model turu başına izin verilen gerçek aramalar. |
@@ -273,4 +273,3 @@ sınırı tüketmez. Uzak `https:` görselleri ve başarısız veya boş açıkl
273273

274274
Anthropic OAuth sidecar'ları opencodex'in mevcut Claude Code OAuth parmak izini
275275
yeniden kullanır. Hedeflenen hesap ve iş yükünü kapsamlı bir şekilde test edin.
276-

‎docs-site/src/content/docs/zh-cn/reference/configuration/server.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Codex 会为标题、提交信息等任务使用较小的辅助模型。启用
145145
| 字段 | 类型 | 默认值 | 含义 |
146146
| --- | --- | --- | --- |
147147
| `enabled?` | `boolean` | 在可用时启用 | 总开关。 |
148-
| `backend?` | `"openai" \| "anthropic"` | auto | 显式优先;否则若可用的 Anthropic OAuth 存储凭据存在则选择 `anthropic`,否则选择 `openai`。 |
148+
| `backend?` | `"openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"` | `openai` | 显式选择优先;未设置时始终使用 `openai`。`xai`、`gemini` 和 `exa` 仅在显式配置后启用。 |
149149
| `model?` | `string` | 依后端而定 | OpenAI 使用 `gpt-5.6-luna`,Anthropic 使用 `claude-sonnet-5`。旧的显式 `gpt-5.4-mini` 会在启动时迁移。 |
150150
| `reasoning?` | `string` | `low` | 侧车努力级别。`minimal` 与 web search 不兼容,会被拒绝。 |
151151
| `maxSearchesPerTurn?` | `number` | `3` | 每个主模型轮次允许的实际搜索次数。 |

‎docs-site/src/content/docs/zh-tw/reference/configuration/server.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Codex 使用小型 helper 模型處理如標題與 commit 訊息等任務。啟
167167
| 欄位 | 型別 | 預設值 | 意義 |
168168
| --- | --- | --- | --- |
169169
| `enabled?` | `boolean` | 可用時開啟 | 主開關。 |
170-
| `backend?` | `"openai" \| "anthropic"` | 自動 | 明確勝出;否則可用的已儲存 Anthropic OAuth 選擇 `anthropic`,然後 `openai`。 |
170+
| `backend?` | `"openai" \| "anthropic" \| "xai" \| "gemini" \| "exa"` | `openai` | 明確選擇優先;未設定時一律使用 `openai`。`xai`、`gemini` 與 `exa` 只會在明確設定後啟用。 |
171171
| `model?` | `string` | 視 backend 而定 | OpenAI 為 `gpt-5.6-luna` 或 Anthropic 為 `claude-sonnet-5`。舊版明確 `gpt-5.4-mini` 在啟動時遷移。 |
172172
| `reasoning?` | `string` | `low` | Sidecar effort。`minimal` 在網頁搜尋時被拒絕。 |
173173
| `maxSearchesPerTurn?` | `number` | `3` | 每個主模型回合允許的實際搜尋。 |

‎src/adapters/openai-responses.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,14 +1363,14 @@ function stripUnsupportedHostedTools(body: unknown): unknown {
13631363
}
13641364

13651365
/**
1366-
* OpenAI-only hosted web_search config fields that non-canonical Responses
1367-
* upstreams reject wholesale. xAI's /v1/responses 400s the entire request on
1366+
* OpenAI hosted web_search config fields that a capability-classified Responses
1367+
* upstream may reject wholesale. xAI's /v1/responses 400s the entire request on
13681368
* `external_web_access` and `search_context_size` ("Argument not supported"),
13691369
* which killed every routed Grok turn whose client (Codex) attaches its
13701370
* default web_search tool config (probe 2026-08-21: both fields 400
13711371
* individually; `user_location` and `filters` are accepted and kept).
1372-
* Canonical ChatGPT-forward traffic is untouched — this runs only on the
1373-
* routed path, so the original behavior stays identical for OpenAI.
1372+
* The caller decides whether to apply this compatibility transform from explicit
1373+
* provider capability metadata; an unclassified upstream keeps the fields.
13741374
*/
13751375
const OPENAI_ONLY_WEB_SEARCH_FIELDS = ["external_web_access", "search_context_size"] as const;
13761376
export function stripOpenAiOnlyWebSearchFields(body: unknown): unknown {
@@ -1581,10 +1581,12 @@ export function createResponsesPassthroughAdapter(provider: OcxProviderConfig):
15811581
const rewritten = rewriteRoutedToolSearchForUpstream(outBody);
15821582
outBody = rewritten.body;
15831583
convertedRoutedToolSearchNames = rewritten.names;
1584-
// Routed Responses upstreams reject OpenAI-only web_search config outright
1585-
// (xAI: HTTP 400 on the whole request). Strip only the two proven-fatal
1586-
// fields; the hosted tool itself passes through untouched.
1587-
outBody = stripOpenAiOnlyWebSearchFields(outBody);
1584+
// xAI rejects these OpenAI web_search extensions with HTTP 400. Keep them
1585+
// for OpenAI API-key traffic and unclassified gateways; only an explicit
1586+
// provider capability denial activates the compatibility transform.
1587+
if (provider.supportsOpenAiWebSearchToolFields === false) {
1588+
outBody = stripOpenAiOnlyWebSearchFields(outBody);
1589+
}
15881590
}
15891591
const sanitizedBody = normalizeToolSchemas(stripSparkCompatibility(stripUnsupportedReasoningParams(stripItemIdsWhenUnstored(stripInvalidItemIds(stripUnsupportedHostedTools(sanitizeReasoningInputContent(scrubOcxCompactionItems(outBody), { preserveRawReasoningContent: provider.preserveResponsesReasoningContent === true })))))));
15901592
const finalBody = stripDisabledReasoningSummaries(

‎src/cli/agent.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const USAGE = `Usage:
2020
ocx agent effort <status|set> [--main <level|->] [--subagent <level|->] [--json]
2121
ocx agent subagents <status|set|clear> [model,model...] [--json]
2222
ocx agent fallback <status|set|clear> [model,model...] [--poll-ms <5000-600000>] [--json]
23-
ocx agent sidecar <status|web|vision> [--list] [--model <id|->] [--backend <openai|anthropic|->]
23+
ocx agent sidecar <status|web|vision> [--list] [--model <id|->] [--backend <openai|anthropic|xai|gemini|exa|->]
2424
[--reasoning <level>] [--max-descriptions <n>] [--json]`;
2525

2626
function clearable(value: string | undefined): string | null | undefined {

0 commit comments

Comments
 (0)