Skip to content

Commit 7e7e782

Browse files
committed
fix(gui): align routing copy with persisted strategy
1 parent 7a44476 commit 7e7e782

13 files changed

Lines changed: 116 additions & 77 deletions

File tree

docs-site/src/content/docs/ja/reference/cli.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,7 @@ API エラーは終了コード 1 です。認証情報フィールドは manage
268268
#### `ocx account use <provider> <account-or-key-id|main> [--json]`
269269

270270
既存の Codex アカウント、OAuth アカウント、または API key を選びます。`openai``main` は Codex App ログインを
271-
選択します。Codex の選択は現在の pool affinity を消去し、既存の表示タスクを含む次のリクエストから適用されます。
272-
処理中のリクエストは取得済みアカウントを維持します。Pool 戦略、使用量ベースのプロアクティブ切り替え、
273-
cooldown/再認証状態、障害回復により、後で別の適格アカウントが選ばれる場合があります。アカウント変更後も
274-
OpenCodex は会話コンテキストを再生しますが、provider prompt cache は再ウォームアップが必要な場合があります。
271+
選択します。Codex Pool の選択は process-local affinity を消去し、既存の表示タスクを含む次のリクエストから適用されます。プロキシ再起動や affinity eviction 後もタスクは未紐付けになり得ますが、処理中のリクエストは取得済みアカウントを維持します。この選択は Pool routing のみを制御し、Direct mode は caller-owned/native main credential を使い続けます。使用量ベースのプロアクティブ切り替え、401/403 再認証、429/retry-after cooldown、除外、出力前 429/402 の障害回復により、後で別の適格 Pool アカウントが選ばれる場合があります。これらの回復経路は使用量ベース切り替えが off でも有効です。アカウント変更後も OpenCodex は会話コンテキストを再生しますが、provider prompt cache は再ウォームアップが必要な場合があります。
275272
不明なプロバイダーや id は終了コード 1 です。`--json` は次を返します。
276273

277274
```text

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespaced selected id を bare id に変えます。
5555
| `codexAccountNamespaces?` | `Record<string,string>` || 公開 model selector namespace から保存済み Codex アカウント target への任意 map。この foundation layer は map を検証・保存しますが、picker row の追加や routing の変更は行いません。 |
5656
| `activeCodexAccountId?` | `string` || 手動選択した pool アカウント。既存 thread affinity を消去して次のリクエストから適用し、処理中のリクエストは現在のアカウントを維持します。 |
5757
| `autoSwitchThreshold?` | `number` | `80` | 使用量ベースのプロアクティブ切り替えしきい値。`quota` は紐付け済み/未紐付けタスクの次のリクエストを再評価でき、`fill-first` は未紐付け割り当ての使い切り基準としてのみ使用し、通常の `round-robin` 選択は使用しません。既知の 5 時間、週次、30 日 quota window の最大スコアを使います。`0` は使用量ベースの切り替えだけを無効にし、未紐付け割り当てや障害回復は無効にしません。 |
58-
| `accountPoolStrategy?` | `"quota" \| "round-robin" \| "fill-first"` | `"quota"` | 新規/未紐付け Codex リクエストの割り当て戦略。live な `(parent thread id, quota scope)` affinity がなければ未紐付けで、プロキシ再起動や affinity リセット後は既存の表示タスクも未紐付けになり得ます。`quota` は既知 usage 最小を選び、`autoSwitchThreshold` 後は紐付け済みタスクも再紐付けできます`round-robin` は未紐付けリクエストを均等分散し、`fill-first` は cooldown、使用不可、または drain threshold までアクティブアカウントへ割り当てます。 |
58+
| `accountPoolStrategy?` | `"quota" \| "round-robin" \| "fill-first"` | `"quota"` | 新規/未紐付け Codex リクエストの割り当て戦略。live な `(parent thread id, quota scope)` affinity がなければ未紐付けで、プロキシ再起動や affinity リセット後は既存の表示タスクも未紐付けになり得ます。`quota` はアクティブアカウントがなければ既知 usage 最小の適格アカウントを選び、適格なアクティブアカウントが `autoSwitchThreshold` 未満なら維持します。しきい値到達後は、未紐付けリクエストまたは紐付け済みタスクの次のリクエストを usage の低い適格アカウントへ移せます`round-robin` は未紐付けリクエストを均等分散し、`fill-first` は cooldown、使用不可、または drain threshold までアクティブアカウントへ割り当てます。 |
5959
| `accountPoolStickyLimit?` | `number` | `1` | 1 回の round-robin 選択で次へ進む前に保持する新規/未紐付けタスク割り当て数。カウンターは上流の成功後ではなくタスクの紐付け時に増えます。範囲 1–100。`accountPoolStrategy``round-robin` のときのみ。 |
6060
| `upstreamFailoverThreshold?` | `number` | `3` | 一時的な上流失敗が連続して起きたのち、以降の新しいセッションを別の適合 pool アカウントに failover する回数。`0` なら失敗ベースの failover をオフにします。 |
6161
| `modelCacheTtlMs?` | `number` | `300000` | プロバイダー別 `/models` キャッシュの有効期間(5 分)。 |
@@ -96,7 +96,7 @@ pause、cooldown、再認証、障害処理も独立して routing を消去ま
9696
状態は再起動後も保持され、すべてのアカウントが一時停止中なら Pool ルーティングは別のアカウントを暗黙に選ばず失敗します。
9797
**上限到達を一括停止** は credential がある適格アカウントだけを先に更新し、関連する quota window が今回 100% と確認できたアカウントだけを停止します。credential がないアカウントや、quota が不明、または更新に失敗したアカウントは変更しません。
9898

99-
**割り当てとプロアクティブ切り替え戦略:** `quota`(既定)は未紐付けリクエストに最小 usage を選び
99+
**割り当てとプロアクティブ切り替え戦略:** `quota`(既定)はアクティブアカウントがない場合に最小 usage の適格アカウントを選び、適格なアクティブアカウントが `autoSwitchThreshold` 未満なら維持します。しきい値到達後は
100100
`autoSwitchThreshold` 超過後は紐付け済みタスクの次のリクエストも再紐付けできます。`round-robin`
101101
未紐付けリクエストを均等分散し、しきい値は通常の rotation を変えません。`accountPoolStickyLimit`
102102
(既定 `1`、1–100)は成功応答ではなく割り当て/紐付け数を数えます。`fill-first` は未紐付けリクエストを

docs-site/src/content/docs/ko/reference/cli.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,7 @@ API 오류는 종료 코드 1입니다. 자격 증명 필드는 management API
309309
#### `ocx account use <provider> <account-or-key-id|main> [--json]`
310310

311311
기존 Codex 계정, OAuth 계정 또는 API key를 선택합니다. `openai`에서 `main`은 Codex App 로그인을
312-
선택합니다. Codex 선택은 현재 pool affinity를 지우고 기존에 보이던 작업을 포함한 다음 요청부터
313-
적용되며, 진행 중인 요청은 이미 확보한 계정을 유지합니다. Pool 전략, 사용량 기반 선제 전환,
314-
cooldown/재인증 상태, 실패 복구는 나중에 다른 적격 계정을 선택할 수 있습니다. 계정이 바뀌어도
315-
OpenCodex는 대화 문맥을 재생하지만 프로바이더 측 prompt cache는 다시 예열해야 할 수 있습니다.
312+
선택합니다. Codex Pool 선택은 프로세스 로컬 affinity를 지우고 기존에 보이던 작업을 포함한 다음 요청부터 적용됩니다. 프록시 재시작이나 affinity eviction 뒤에도 작업이 바인딩 없는 상태가 될 수 있지만, 진행 중인 요청은 이미 확보한 계정을 유지합니다. 이 선택은 Pool 라우팅만 제어하며 Direct mode는 호출자 소유/native main credential을 계속 사용합니다. 사용량 기반 선제 전환, 401/403 재인증, 429/retry-after cooldown, 제외, 출력 전 429/402 실패 복구는 나중에 다른 적격 Pool 계정을 선택할 수 있습니다. 이러한 복구 경로는 사용량 기반 전환이 꺼져 있어도 동작합니다. 계정이 바뀌어도 OpenCodex는 대화 문맥을 재생하지만 프로바이더 측 prompt cache는 다시 예열해야 할 수 있습니다.
316313
알 수 없는 프로바이더나 id는 종료 코드 1입니다. `--json`은 다음을 반환합니다.
317314

318315
```text

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespaced selected id를 bare id로 바꿉니다.
5656
| `codexAccountNamespaces?` | `Record<string,string>` || 공개 model selector namespace에서 저장된 Codex 계정 target으로 연결하는 선택적 map입니다. 이 foundation layer는 map을 검증하고 저장하지만 picker row를 추가하거나 routing을 변경하지 않습니다. |
5757
| `activeCodexAccountId?` | `string` || 수동으로 선택한 pool 계정. 선택 시 기존 thread affinity를 지우고 다음 요청부터 적용하며, 진행 중인 요청은 기존 계정을 유지합니다. |
5858
| `autoSwitchThreshold?` | `number` | `80` | 사용량 기반 선제 전환 임계값입니다. `quota`는 바인딩된 작업과 바인딩 없는 작업의 다음 요청을 모두 재평가할 수 있고, `fill-first`는 바인딩 없는 작업 배정의 소진 기준으로만 사용하며, 기본 `round-robin` 선택은 이 값을 사용하지 않습니다. 알려진 5시간, 주간, 30일 quota window 중 가장 높은 점수를 씁니다. `0`은 사용량 기반 전환만 끄며 바인딩 없는 작업 배정이나 실패 복구는 끄지 않습니다. |
59-
| `accountPoolStrategy?` | `"quota" \| "round-robin" \| "fill-first"` | `"quota"` | 새 작업/바인딩 없는 Codex 요청의 계정 배정 전략입니다. `(parent thread id, quota scope)`의 live affinity가 없으면 바인딩 없는 요청이며, 프록시 재시작이나 affinity 초기화 뒤에는 기존에 보이던 작업도 바인딩이 없어질 수 있습니다. `quota`는 알려진 usage가 가장 낮은 계정을 고르고 `autoSwitchThreshold` 바인딩된 작업도 선제 재바인딩할 수 있습니다. `round-robin`은 바인딩 없는 요청을 균등 분배하고, `fill-first`는 cooldown, 사용 불가 또는 drain threshold까지 활성 계정에 배정합니다. |
59+
| `accountPoolStrategy?` | `"quota" \| "round-robin" \| "fill-first"` | `"quota"` | 새 작업/바인딩 없는 Codex 요청의 계정 배정 전략입니다. `(parent thread id, quota scope)`의 live affinity가 없으면 바인딩 없는 요청이며, 프록시 재시작이나 affinity 초기화 뒤에는 기존에 보이던 작업도 바인딩이 없어질 수 있습니다. `quota`활성 계정이 없을 때 알려진 usage가 가장 낮은 적격 계정을 선택하고, 적격 활성 계정이 `autoSwitchThreshold` 미만이면 유지합니다. 임계값 도달 뒤에는 바인딩 없는 요청이나 바인딩된 작업의 다음 요청을 usage가 더 낮은 적격 계정으로 옮길 수 있습니다. `round-robin`은 바인딩 없는 요청을 균등 분배하고, `fill-first`는 cooldown, 사용 불가 또는 drain threshold까지 활성 계정에 배정합니다. |
6060
| `accountPoolStickyLimit?` | `number` | `1` | 한 round-robin 선택이 다음으로 넘어가기 전에 유지하는 새 작업/바인딩 없는 작업 배정 수입니다. 카운터는 업스트림 성공 뒤가 아니라 작업을 바인딩할 때 증가합니다. 범위 1–100이며 `accountPoolStrategy``round-robin`일 때만 적용됩니다. |
6161
| `upstreamFailoverThreshold?` | `number` | `3` | 일시적인 업스트림 실패가 연속으로 발생한 뒤, 이후 새 세션을 다른 적합한 pool 계정으로 failover할 횟수. `0`이면 실패 기반 failover를 끕니다. |
6262
| `modelCacheTtlMs?` | `number` | `300000` | 프로바이더별 `/models` 캐시의 유효 기간(5분). |
@@ -100,8 +100,8 @@ affinity 초기화 뒤의 기존 작업도 포함될 수 있습니다. 출력
100100
상태는 재시작 후에도 유지되며, 모든 계정이 일시 중지되면 Pool 라우팅은 계정을 몰래 선택하지 않고 실패합니다.
101101
**한도 도달 계정 일시 중지**는 credential이 있는 적격 계정만 먼저 새로고친 뒤 관련 quota window가 이번 응답에서 100%로 확인된 계정만 일시 중지합니다. credential이 없는 계정과 quota가 없거나 새로고침에 실패한 계정은 변경하지 않습니다.
102102

103-
**배정 및 선제 전환 전략:** `quota`(기본)는 바인딩 없는 요청에 최저 usage 계정을 배정하고,
104-
활성 계정이 `autoSwitchThreshold`를 넘으면 바인딩된 작업의 다음 요청도 재바인딩할 수 있습니다.
103+
**배정 및 선제 전환 전략:** `quota`(기본)는 활성 계정이 없을 때 최저 usage의 적격 계정을 선택하고,
104+
적격 활성 계정이 `autoSwitchThreshold` 미만이면 유지합니다. 임계값 도달 뒤에는 바인딩 없는 요청이나 바인딩된 작업의 다음 요청을 usage가 더 낮은 적격 계정으로 옮길 수 있습니다.
105105
`round-robin`은 바인딩 없는 요청을 균등 분배하며 임계값은 기본 순환에 영향을 주지 않습니다.
106106
`accountPoolStickyLimit`(기본 `1`, 1–100)은 성공 응답이 아니라 배정/바인딩 횟수를 셉니다.
107107
`fill-first`는 바인딩 없는 요청을 cooldown, 재인증 또는 drain threshold까지 활성 계정에 배정하고,

docs-site/src/content/docs/reference/cli.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,14 @@ returns:
367367
#### `ocx account use <provider> <account-or-key-id|main> [--json]`
368368

369369
Selects an existing Codex account, OAuth account, or API key. For `openai`, `main` selects the Codex
370-
App login. A Codex selection clears current pool affinity and applies to the next request, including
371-
one from an existing visible task; in-flight requests keep their captured account. Pool strategy,
372-
usage-based proactive switching, cooldown/reauthentication state, and failure recovery may later
373-
select another eligible account. OpenCodex replays the conversation after an account change, but
374-
the provider-side prompt cache may be cold. Unknown providers or ids exit 1.
370+
App login. A Codex Pool selection clears process-local affinity and applies to the next request,
371+
including one from an existing visible task; proxy restart or affinity eviction can also leave a task
372+
unbound, while in-flight requests keep their captured account. This controls Pool routing only;
373+
Direct mode keeps using the caller-owned/native main credential. Usage-based proactive switching,
374+
401/403 reauthentication, 429/retry-after cooldowns, exclusion, and pre-output 429/402 failure
375+
recovery may later select another eligible Pool account. Those recovery paths remain active when
376+
usage-based switching is off. OpenCodex replays the conversation after an account change, but the
377+
provider-side prompt cache may be cold. Unknown providers or ids exit 1.
375378
`--json` returns:
376379

377380
```text

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ differing backup and rewrites known legacy namespaced selected ids to bare ids.
6161
| `codexAccountNamespaces?` | `Record<string,string>` || Optional public model-selector namespace → stored Codex account target map. This foundation layer validates and persists the map but does not add picker rows or change routing. |
6262
| `activeCodexAccountId?` | `string` || Manually selected Pool account. Selection clears existing thread affinity and applies to the next request; in-flight requests keep their captured account. |
6363
| `autoSwitchThreshold?` | `number` | `80` | Usage threshold for proactive switching. `quota` can re-evaluate both bound and unbound tasks on their next request; `fill-first` uses it only as the drain point for unbound assignment; normal `round-robin` selection does not use it. The score uses the hottest known 5h, weekly, or 30d quota window. `0` disables usage-based proactive switching only, not unbound assignment or failure recovery. |
64-
| `accountPoolStrategy?` | `"quota" \| "round-robin" \| "fill-first"` | `"quota"` | Assignment strategy for new/unbound Codex requests. A request is unbound when it has no live `(parent thread id, quota scope)` affinity; a visible existing task can become unbound after proxy restart or affinity reset. `quota` picks the lowest known usage and may proactively rebind a bound task after `autoSwitchThreshold`; `round-robin` distributes unbound requests evenly; `fill-first` keeps assigning unbound requests to the active account until cooldown, unavailability, or the configured drain threshold. |
64+
| `accountPoolStrategy?` | `"quota" \| "round-robin" \| "fill-first"` | `"quota"` | Assignment strategy for new/unbound Codex requests. A request is unbound when it has no live `(parent thread id, quota scope)` affinity; a visible existing task can become unbound after proxy restart or affinity reset. `quota` picks the lowest-usage eligible account when no active account exists, keeps an eligible active account below `autoSwitchThreshold`, and after the threshold may move an unbound request or proactively rebind a bound task to a lower-usage eligible account. `round-robin` distributes unbound requests evenly; `fill-first` keeps assigning unbound requests to the active account until cooldown, unavailability, or the configured drain threshold. |
6565
| `accountPoolStickyLimit?` | `number` | `1` | Number of new/unbound task assignments retained on one round-robin selection before advancing. The counter advances when a task is bound, not after an upstream success. Range 1–100; only applies when `accountPoolStrategy` is `round-robin`. |
6666
| `upstreamFailoverThreshold?` | `number` | `3` | Consecutive transient upstream failures before future new sessions fail over to another eligible pool account. Set `0` to disable failure failover. |
6767
| `modelCacheTtlMs?` | `number` | `300000` | Freshness window for the per-provider `/models` cache (5 min). |
@@ -163,7 +163,7 @@ and unknown or failed quota refreshes are left unchanged.
163163

164164
| Strategy | Behaviour |
165165
| --- | --- |
166-
| `quota` (default) | For unbound requests, pick the lowest-usage eligible account across 5h, weekly, and 30d windows. A bound task can also be rebound on its next request after the active account crosses `autoSwitchThreshold`. `autoSwitchThreshold: 0` disables this usage-driven re-evaluation, not failure recovery. |
166+
| `quota` (default) | If no active account exists, pick the lowest-usage eligible account across 5h, weekly, and 30d windows. Otherwise retain an eligible active account below `autoSwitchThreshold`; after it crosses the threshold, an unbound request or a bound task's next request can move to a lower-usage eligible account. `autoSwitchThreshold: 0` disables this usage-driven re-evaluation, not failure recovery. |
167167
| `round-robin` | Evenly assign unbound requests across eligible accounts. `autoSwitchThreshold` does not change normal round-robin selection. `accountPoolStickyLimit` (default `1`, range 1–100) counts assignments/bindings on one pick, not successful upstream responses. |
168168
| `fill-first` | Assign unbound requests to the active account until cooldown, reauthentication, or (when set) the `autoSwitchThreshold` drain point; unknown usage does not force a switch. Healthy bound tasks keep affinity. |
169169

0 commit comments

Comments
 (0)