Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1da0a67
fix(codex): refuse responses input beyond the advertised context window
HoshimiRox1 Aug 6, 2026
00cecba
fix(codex): stop compounding replayed history on already-full requests
HoshimiRox1 Aug 10, 2026
132bec7
docs(responses): document canonical replay item identity
HoshimiRox1 Aug 12, 2026
0598def
docs(responses): document oversized input rejection and replay dedup
HoshimiRox1 Aug 12, 2026
60b229e
fix(responses): count instructions and tool schemas in input guard
HoshimiRox1 Aug 12, 2026
7c3396b
fix(responses): enforce effective input limit before quota polling
HoshimiRox1 Aug 12, 2026
d468fb2
fix(responses): validate fallback candidates before quota priming
HoshimiRox1 Aug 12, 2026
4080bb7
fix(responses): validate every selectable fallback before quota priming
HoshimiRox1 Aug 12, 2026
bd48ddb
fix(responses): bound request and schema serialization in admission
HoshimiRox1 Aug 12, 2026
16e0e50
docs(responses): document new admission helpers
HoshimiRox1 Aug 12, 2026
d6eb6ab
fix(responses): keep admission JSON walks stack-safe and allocation-b…
HoshimiRox1 Aug 12, 2026
bd59911
fix(responses): traverse custom-tool payloads without recursion
HoshimiRox1 Aug 12, 2026
ba0826d
fix(responses): canonicalize web_search_call query/queries backfill skew
HoshimiRox1 Aug 12, 2026
ce3a868
fix(responses): finish admission hardening review round
HoshimiRox1 Aug 12, 2026
0a51663
fix(responses): address second CodeRabbit review round
HoshimiRox1 Aug 12, 2026
4c5a72e
fix(responses): skip unroutable fallback candidates in admission sizing
HoshimiRox1 Aug 12, 2026
e8377dc
fix(responses): stop fallback admission loop from overwriting route d…
HoshimiRox1 Aug 12, 2026
ce6c86a
fix(responses): complete admission limit resolution and estimator cov…
HoshimiRox1 Aug 12, 2026
7e99bb7
fix(responses): dedupe candidate admission scans and sync translated …
HoshimiRox1 Aug 12, 2026
6de7a8e
fix(responses): count message metadata and reuse the web-search plan
HoshimiRox1 Aug 12, 2026
aa545fc
fix(responses): harden replay and input admission
HoshimiRox1 Aug 13, 2026
bc085ae
docs(responses): complete helper docstrings
HoshimiRox1 Aug 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs-site/src/content/docs/ja/reference/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ HTTP の境界は `server/index.ts` が担い、Responses データプレーン
`POST /v1/live` / `POST /v1/realtime/calls`(ChatGPT / Codex App 音声と OpenAI Realtime
の call-create、`server/live.ts` が中継)と `/v1/live/{callId}` サイドバンド WebSocket、
`/v1/responses` のオプション WebSocket アップグレードを提供します。
2. `server/responses/core.ts` が展開し JSON を読みます。覚えておいた `previous_response_id` 入力があれば展開したのち `responses/parser.ts` に渡します
2. `server/responses/core.ts` が圧縮を解除して JSON を解析し、記憶済みの `previous_response_id` 入力を展開します。完全な履歴再送をそのまま保持するのは、保持された provider item id または tool call id が完全な接頭辞の再送を証明する場合だけです。内容が同じだけなら各出現を保守的に保持します。その後 `responses/parser.ts` に渡し、実効入力上限と推定誤差帯を超える入力を上流 I/O 前に `413 request_too_large` で拒否します
3. `router.ts` が通常のモデル id または `provider/model` id を解決します。続いて Codex アカウント affinity を決定し、必要ならプロバイダー OAuth を更新して選択された認証情報を route に適用します。
4. 本リクエストの前に `vision/` が `noVisionModels` モデル用の画像説明を作ります。安全なサイドカー経路がないときはテキスト専用の上流に画像を送らず取り除きます。
5. `server/adapter-resolve.ts` がモデル別の wire override を適用し、7つのアダプターのいずれかを作ります。
Expand Down
9 changes: 9 additions & 0 deletions docs-site/src/content/docs/ja/reference/proxy-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ provider events → internal adapter events → client dialect

未知の項目タイプは、前方互換性のためにルーズタイプの項目として受け入れられます。変換されたアダプターは、認識する項目タイプのみを処理し、プロバイダーが表現できない機能を拒否する場合があります。

解析済みの `input` の近似見積もりが、ルーティング先モデルの実効入力上限に 10% の推定誤差帯を
加えた値を超える場合、`413 request_too_large`(code `input_context_window_exceeded`)で
拒否されます。見積もりはメッセージ、`instructions`、ツール、構造化出力スキーマを集計し、画像と
後続の guidance、圧縮プロンプト、bridge ツール注入には別の上限予約を使います。base64 を通常テキストとして
数えません。ガードはクォータ、sidecar、adapter、モデル上流 I/O より前に動作し、terminal-guard continuation
も自身の送信前に再検査されます。誤差帯内は provider の tokenizer に委ねます。完全履歴は provider item id
または tool call id が完全な保存済み接頭辞の再送を証明するときだけ重複除去されます。

### JSON および SSE 出力

`stream: true` の場合、応答は `text/event-stream` となります。ブリッジは、`response.created`、出力項目およびテキスト/ツール デルタ、および 1 つの端末 `response.completed`、`response.failed`、または `response.incomplete` イベントなどの応答イベントを発行します。通常のストリームは `data: [DONE]` で終了します。
Expand Down Expand Up @@ -211,6 +219,7 @@ Responses-family および Chat リクエストは、プロバイダーまたは
| 503 | `combo_unavailable` |選択したコンボ内のすべてのターゲットは使用不可、クールダウン中、無効、またはその他の理由で不適格です。
| 400 | `unreadable_encrypted_agent_task` |暗号化された v2 ワーカー タスクには、それを使用できる適格なネイティブ ChatGPT ターゲットがありません。
| 426 | `upgrade_required` |応答 WebSocket トランスポートが無効になっているか、アップグレードが失敗しました。 HTTP を使用する |
| 413 | `request_too_large` | 推定 `input` が実効入力上限と 10% の推定誤差帯を超える(code `input_context_window_exceeded`)。クォータ、sidecar、adapter、モデル上流 I/O の前に拒否 |

Anthropic オリジンの失敗は Anthropic のエラー エンベロープでレンダリングされるため、オリジンの拒否は OpenAI スタイルの `origin_rejected` 本体ではなく、その方言上の 403 `permission_error` になります。

Expand Down
7 changes: 5 additions & 2 deletions docs-site/src/content/docs/ko/reference/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ HTTP 경계는 `server/index.ts`가 맡고, Responses 데이터 플레인은 `se
`POST /v1/live` / `POST /v1/realtime/calls`(ChatGPT / Codex App 음성 및 OpenAI Realtime
호출 생성, `server/live.ts`가 중계)와 `/v1/live/{callId}` 사이드밴드 WebSocket,
그리고 `/v1/responses`의 선택적 WebSocket 업그레이드를 제공합니다.
2. `server/responses/core.ts`가 압축을 풀고 JSON을 읽습니다. 기억해 둔 `previous_response_id` 입력이 있으면
펼친 다음 `responses/parser.ts`로 넘깁니다.
2. `server/responses/core.ts`가 압축을 풀고 JSON을 읽은 뒤 기억해 둔 `previous_response_id` 입력을
펼칩니다. 전체 기록 재전송은 보존된 provider item id 또는 tool call id가 전체 접두사의 재전송임을
증명할 때만 그대로 유지됩니다. 내용만 같은 경우에는 각 출현을 보수적으로 보존합니다. 이후
`responses/parser.ts`로 넘기며, 유효 입력 한도와 추정 오차 대역을 넘는 입력은 업스트림 I/O 전에
`413 request_too_large`로 거부됩니다.
3. `router.ts`가 일반 모델 id 또는 `provider/model` id를 해석합니다. 이어서 Codex 계정 affinity를
결정하고, 필요하면 프로바이더 OAuth를 갱신해 선택된 자격 증명을 route에 적용합니다.
4. 본 요청 전에 `vision/`이 `noVisionModels` 모델용 이미지 설명을 만듭니다. 안전한 사이드카 경로가
Expand Down
9 changes: 9 additions & 0 deletions docs-site/src/content/docs/ko/reference/proxy-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ Responses 표현이 이 연결의 중심입니다. 네이티브 호환 경로는
알 수 없는 항목 유형은 앞으로의 호환성을 위해 느슨한 형식의 typed item으로 허용됩니다. 변환된 어댑터는
자신이 인식하는 항목 유형만 처리하며, 제공자가 표현할 수 없는 기능은 거부할 수 있습니다.

파싱된 `input`의 근사 추정치가 라우팅된 모델의 유효 입력 한도에 10% 추정 오차 대역을 더한
값을 넘으면 `413 request_too_large`(code `input_context_window_exceeded`)로 거부됩니다.
추정치는 메시지, `instructions`, 도구, 구조화 출력 스키마를 합산하고 이미지 및 이후의 guidance,
압축 프롬프트, bridge 도구 주입에는 별도의 제한된 여유를 둡니다. base64를 일반 텍스트로 계산하지
않습니다. 가드는 할당량, sidecar, adapter, 모델 업스트림 I/O 전에 실행되며 terminal-guard continuation도
자체 전송 전에 다시 검사됩니다. 오차 대역 안의 요청은 provider tokenizer가 결정합니다. 전체 기록은
provider item id 또는 tool call id가 저장된 전체 접두사의 재전송임을 증명할 때만 중복 제거됩니다.

### JSON과 SSE 출력

`stream: true`이면 응답은 `text/event-stream`입니다. 브리지는 `response.created`, output-item과 text/tool
Expand Down Expand Up @@ -254,6 +262,7 @@ data-plane key는 management credential이 아닙니다. management API는 별
| 503 | `combo_unavailable` | 선택한 combo의 모든 대상이 사용할 수 없거나, cooldown 중이거나, 비활성화되어 있거나, 다른 이유로 부적합합니다 |
| 400 | `unreadable_encrypted_agent_task` | 암호화된 v2 worker task를 소비할 수 있는 적격 네이티브 ChatGPT 대상이 없습니다 |
| 426 | `upgrade_required` | Responses WebSocket transport가 비활성화되어 있거나 업그레이드에 실패했습니다. HTTP를 사용하십시오 |
| 413 | `request_too_large` | 추정 `input`이 유효 입력 한도와 10% 추정 오차 대역을 초과합니다(code `input_context_window_exceeded`). 할당량, sidecar, adapter, 모델 업스트림 I/O 전에 거부됩니다 |

Anthropic-origin 실패는 Anthropic의 error envelope로 렌더링됩니다. 따라서 해당 방언에서 origin 거부는
OpenAI 스타일 `origin_rejected` body가 아니라 403 `permission_error`입니다.
Expand Down
6 changes: 5 additions & 1 deletion docs-site/src/content/docs/reference/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ the `server/responses.ts` facade and its `server/responses/*.ts` modules:
`/v1/live/{callId}` (and `/v1/realtime?call_id=`), and the optional WebSocket upgrade on
`/v1/responses`.
2. `server/responses/core.ts` decompresses and parses JSON, expands locally remembered
`previous_response_id` input when available, then calls `responses/parser.ts`.
`previous_response_id` input when available. A full-history resend is preserved only when
a retained provider item id or tool call id proves the complete prefix is replayed; ambiguous
content equality keeps every occurrence. It then calls `responses/parser.ts`; input estimated
above the routed model's effective limit plus the admission uncertainty band is rejected with
`413 request_too_large` before any upstream I/O.
3. `router.ts` resolves a bare or `provider/model` id. The server then resolves Codex account
affinity, refreshes provider OAuth when needed, and applies the selected credential to the route.
4. Before the main call, `vision/` describes images for models in `noVisionModels`; if no safe
Expand Down
20 changes: 20 additions & 0 deletions docs-site/src/content/docs/reference/proxy-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ non-empty `model`. `input` may be a string or an array of Responses items.
Unknown item types are accepted as loose typed items for forward compatibility. Translated adapters
handle only the item types they recognize, and may reject a feature their provider cannot represent.

Requests whose parsed `input` is estimated — using an approximate, model-aware token estimate over
message text, `instructions`, tool definitions, and structured-output schemas, plus separate
bounded reserves for images and deterministic later injections — to exceed the routed model's
effective input limit (per-model maximum input, falling back to the context window resolved from
provider, registry, or catalog metadata) by more than the 10% estimator uncertainty band are rejected with
`413 request_too_large` (code `input_context_window_exceeded`) before adapter construction and
model-serving upstream I/O. Body admission (decompression, size caps, parsing) precedes the guard.
HTTP requests are also rejected before authentication; WebSocket frames have already passed
handshake authentication and origin admission, so for them the guard runs before per-turn adapter
construction and upstream I/O. The guard reserves pending guidance, compaction, bridge-tool, and
vision-description mutations before quota or sidecar work, and rechecks terminal-guard continuations
before their upstream send. Estimates inside the uncertainty band are forwarded for the provider's
tokenizer to decide. Codex compacts well before this limit, so an oversized
body indicates abnormal duplication — for example a chained continuation that resends the full
conversation to a stateless provider. Such a resend is deduplicated only when a retained provider
item id or tool call id proves the complete stored prefix; content equality alone never drops an
occurrence. Compact the conversation or start a new thread and retry; the rejected request is never
forwarded upstream.

Comment thread
HoshimiRox1 marked this conversation as resolved.
### JSON and SSE output

With `stream: true`, the response is `text/event-stream`. The bridge emits Responses events such as
Expand Down Expand Up @@ -278,6 +297,7 @@ Errors use the client dialect's envelope where needed, but these status/code mea
| 503 | `combo_unavailable` | Every target in the selected combo is unavailable, in cooldown, disabled, or otherwise ineligible |
| 400 | `unreadable_encrypted_agent_task` | An encrypted v2 worker task has no eligible native ChatGPT target that can consume it |
| 426 | `upgrade_required` | The Responses WebSocket transport is disabled or the upgrade failed; use HTTP |
| 413 | `request_too_large` | Estimated parsed `input` exceeds the routed model's effective input limit plus the 10% estimator uncertainty band (code `input_context_window_exceeded`); rejected before quota, sidecar, adapter, or model-serving upstream I/O |

Anthropic-origin failures are rendered in Anthropic's error envelope, so the origin rejection is a
403 `permission_error` on that dialect rather than the OpenAI-style `origin_rejected` body.
Expand Down
8 changes: 6 additions & 2 deletions docs-site/src/content/docs/ru/reference/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ src/
(создание голосового/Realtime-вызова ChatGPT / Codex App, ретранслируется `server/live.ts`),
sideband WebSocket на `/v1/live/{callId}`, а также необязательный WebSocket-апгрейд на
`/v1/responses`.
2. `server/responses/core.ts` распаковывает и парсит JSON, разворачивает локально запомненный вход
`previous_response_id`, когда он доступен, затем вызывает `responses/parser.ts`.
2. `server/responses/core.ts` распаковывает и парсит JSON и разворачивает локально запомненный
`previous_response_id`. Полная история сохраняется без повторного добавления только когда
сохранённый provider item id или tool call id доказывает повтор полной префиксной истории; одно
совпадение содержимого сохраняет оба вхождения. Затем вызывается `responses/parser.ts`, а вход,
превышающий действующий лимит вместе с полосой погрешности оценки, отклоняется с
`413 request_too_large` до любого upstream-I/O.
3. `router.ts` разрешает «голый» id или id вида `provider/model`. Затем сервер определяет
привязку (affinity) аккаунта Codex, при необходимости обновляет OAuth провайдера и применяет
выбранные учётные данные к маршруту.
Expand Down
10 changes: 10 additions & 0 deletions docs-site/src/content/docs/ru/reference/proxy-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ control и safety ответа всё равно происходят на гр
Translated-adapter'ы обрабатывают только известные им типы и могут отвергнуть функцию, которую
их провайдер не умеет выразить.

Запрос отклоняется с `413 request_too_large` (code `input_context_window_exceeded`), когда
приблизительная оценка разобранного `input` превышает действующий лимит маршрутизируемой модели
вместе с 10% полосой погрешности. Оценка суммирует сообщения, `instructions`, инструменты и схемы
структурированного вывода, а для изображений и последующих вставок guidance, compaction prompt и bridge
tools использует отдельные ограниченные резервы; base64 не считается обычным текстом. Проверка проходит
до quota, sidecar, adapter и модельного upstream-I/O, а terminal-guard continuation повторно проверяется
перед своей отправкой. Значения внутри полосы оставляются tokenizer'у провайдера. Полная история
дедуплицируется только когда provider item id или tool call id доказывает повтор всего сохранённого префикса.

### JSON и SSE-вывод

При `stream: true` ответ идёт как `text/event-stream`. Мост испускает события Responses вроде
Expand Down Expand Up @@ -272,6 +281,7 @@ Direct, поэтому remote proxy key здесь обязан идти чер
| 503 | `combo_unavailable` | Все цели выбранной combo недоступны, в cooldown, отключены или иным образом не подходят |
| 400 | `unreadable_encrypted_agent_task` | У шифрованной задачи воркера v2 нет подходящей нативной цели ChatGPT, способной её прочитать |
| 426 | `upgrade_required` | Транспорт Responses WebSocket выключен или upgrade не удался; используйте HTTP |
| 413 | `request_too_large` | Оценённый `input` превышает действующий лимит и 10% полосу погрешности (code `input_context_window_exceeded`); отклоняется до quota, sidecar, adapter и модельного upstream-I/O |

Сбои, пришедшие с Anthropic-side, отрисовываются в error envelope Anthropic, поэтому отклонение
origin превращается в 403 `permission_error`, а не в OpenAI-style body `origin_rejected`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ src/
建连,由 `server/live.ts` 中继)、`/v1/live/{callId}` 旁路 WebSocket,
以及 `/v1/responses` 上可选的 WebSocket upgrade。
2. `server/responses/core.ts` 解压并解析 JSON;如果本地记住了对应输入,则展开
`previous_response_id`,随后调用 `responses/parser.ts`。
`previous_response_id`。只有保留的 provider item id 或 tool call id 能证明完整前缀确为
重放时,完整历史才会原样保留;仅内容相同仍会保守地保留每次出现。随后调用
`responses/parser.ts`;估算超过目标模型有效输入上限及准入误差带的输入会在任何上游 I/O
之前以 `413 request_too_large` 被拒绝。
3. `router.ts` 解析 bare id 或 `provider/model` id。server 随后确定 Codex account affinity,
必要时刷新 provider OAuth,并把选中的 credential 应用到 route。
4. 主请求发出前,`vision/` 会为 `noVisionModels` 中的模型描述图像。如果没有安全的 sidecar
Expand Down
Loading
Loading