Skip to content

Commit aa0dd50

Browse files
authored
Merge pull request #4349 from lidge-jun/codex/260912-60plus-models-effort-caps
fix(chat): enforce effort ceilings without model pins
2 parents 7bfb2ad + 300ee08 commit aa0dd50

24 files changed

Lines changed: 116 additions & 10 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,6 @@ Les plafonds s’appliquent uniquement à la fonctionnalité de collaboration v2
119119

120120
Un plafond ne peut que réduire l’effort. Le niveau retenu est le niveau annoncé le plus élevé qui ne dépasse pas le plafond. Si le modèle ne propose aucun contrôle d’effort ou si aucun niveau pris en charge ne convient, opencodex supprime le paramètre d’effort et laisse le fournisseur appliquer sa valeur par défaut. `max` et `ultra` sont acceptés, tandis que le tableau de bord propose les niveaux de `low` à `xhigh`.
121121

122+
Les plafonds configurés s’appliquent aussi aux tours Chat Completions natifs admissibles sans effort épinglé pour le modèle. La conversion vers la valeur du fournisseur intervient lorsqu’un épinglage est appliqué ou qu’un plafond modifie la valeur ; sinon, la valeur de l’appelant natif conserve sa forme d’origine.
123+
122124
Pour une présentation destinée aux débutants des comportements v1, default et v2, consultez [Surfaces de sous-agents](/fr/guides/sub-agent-surface/).

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,6 @@ opencodex は、無効、ルーティング不能、異常、冷却期間、ま
8787

8888
キャップは労力を軽減するだけです。これらは、キャップまたはキャップの下で宣伝されている最も高い段にスナップします。モデルにエフォート制御がない場合、またはサポートされているラングフィットがない場合、opencodex はエフォートを削除し、プロバイダーのデフォルトを適用します。 `max` および `ultra` が受け入れられますが、ダッシュボードでは `low` から `xhigh` が提供されます。
8989

90+
モデルの effort pin がなくても、対象のネイティブ Chat Completions ターンには設定された上限が適用されます。pin を適用した場合、または上限で値を変更した場合にプロバイダーの送信値へ変換し、どちらも起きない呼び出し元の値は元の表記を維持します。
91+
9092
v1、デフォルト、および v2 の動作に関する初心者向けの説明については、「[サブエージェントサーフェス](/guides/sub-agent-surface/)」を参照してください。

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,6 @@ opencodex는 비활성, 라우팅 불가, 비정상, 쿨다운 중, 또는 할
8787

8888
상한은 노력만 낮춥니다. 모델이 광고한 단계 중 상한 이하에서 가장 높은 단계로 맞춥니다. 모델에 노력 제어가 없거나 맞는 지원 단계가 없으면, opencodex는 노력을 제거하고 제공자 기본값을 적용합니다. `max`와 `ultra`는 허용되며, 대시보드는 `low`부터 `xhigh`까지 제공합니다.
8989

90+
모델 effort pin이 없어도 적용 대상 native Chat Completions 요청에는 설정된 상한이 적용됩니다. pin을 적용하거나 상한이 값을 바꾼 경우에 제공자 전송 값으로 매핑하며, 둘 다 없으면 호출자 값은 원래 표기를 유지합니다.
91+
9092
v1, default, v2 동작에 대한 초보자용 설명은 [Sub-agent surfaces](/guides/sub-agent-surface/)를 참고하세요.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ Caps only lower effort. They snap to the highest advertised rung at or below the
253253
no effort control or no supported rung fits, opencodex removes the effort and lets the provider default
254254
apply. `max` and `ultra` are accepted, while the dashboard offers `low` through `xhigh`.
255255

256+
Configured caps also apply to eligible native Chat Completions turns that carry no model effort pin. Provider wire mapping runs when a pin is applied or when a cap changes the value; a native caller value keeps its original wire spelling when neither happens.
257+
256258
For a beginner-oriented explanation of v1, default, and v2 behavior, see
257259
[Sub-agent surfaces](/guides/sub-agent-surface/).
258260

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,7 @@ Cap'ы умеют только понижать effort. Они опускают
136136
помещается под cap, opencodex убирает поле effort и позволяет провайдеру применить собственный
137137
дефолт. `max` и `ultra` принимаются, хотя дашборд предлагает только `low`–`xhigh`.
138138

139+
Настроенные потолки применяются и к подходящим нативным запросам Chat Completions без закреплённого effort модели. Преобразование в значение провайдера выполняется, когда применяется закрепление или потолок меняет значение; иначе значение нативного вызывающего клиента сохраняет исходное написание.
140+
139141
Если нужен объясняющий вариант для начинающих о поведении v1, default и v2, см.
140142
[Поверхность подагентов](/guides/sub-agent-surface/).

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,7 @@ hiçbir basamak uymuyorsa opencodex çabayı kaldırır ve sağlayıcı varsayı
259259
uygulanmasına izin verir. `max` ve `ultra` kabul edilirken kontrol paneli `low`
260260
ile `xhigh` arasını sunar.
261261

262+
Yapılandırılmış sınırlar, model effort sabitlemesi olmayan uygun yerel Chat Completions turlarına da uygulanır. Sağlayıcının iletim değerine eşleme yalnızca sabitleme uygulandığında veya sınır değeri değiştirdiğinde yapılır; aksi hâlde yerel çağıran değeri özgün yazımını korur.
263+
262264
v1, varsayılan ve v2 davranışının yeni başlayanlara yönelik açıklaması için [Alt
263265
ajan yüzeyleri](/tr/guides/sub-agent-surface/) sayfasına bakın.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,6 @@ opencodex 会跳过已禁用、不可路由、不健康、处于冷却中,或
8686

8787
上限只会降低 effort。它们会向下贴合到不高于上限、且模型公开的最高档位。如果模型没有 effort 控制,或者没有任何受支持的档位可用,opencodex 会移除 effort,让提供方默认值生效。`max` 和 `ultra` 都可接受,而仪表板提供 `low` 到 `xhigh`。
8888

89+
即使没有设置模型 effort pin,符合条件的原生 Chat Completions 轮次也会应用配置的上限。仅在应用 pin 或上限改变值时才映射为提供方的传输值;两者都未发生时,原生调用方值保留原始写法。
90+
8991
关于 v1、default 和 v2 行为的面向初学者说明,请参阅 [Sub-agent surfaces](/guides/sub-agent-surface/)。

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,6 @@ opencodex 會跳過已停用、不可路由、不健康、冷卻中或達到配
7171

7272
上限僅會降低 effort。它們吸附到上限或以下的最高宣告級別。若模型沒有 effort 控制或沒有支援的級別符合,opencodex 會移除 effort 並讓供應商預設值套用。`max` 與 `ultra` 被接受,而儀表板提供 `low` 到 `xhigh`。
7373

74+
即使沒有設定模型 effort pin,符合條件的原生 Chat Completions 回合也會套用設定的上限。套用 pin 或上限改變值時才會對應為供應商的傳輸值;兩者皆未發生時,原生呼叫端值保留原始寫法。
75+
7476
關於 v1、default 與 v2 行為的入門導向說明,請見[子代理介面](/zh-tw/guides/sub-agent-surface/)。

‎src/server/chat-native.ts‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,27 @@ function normalizePinnedChatEffort(options: HandleNativeChatOptions): void {
105105
const from = typeof chatBody.reasoning_effort === "string" ? chatBody.reasoning_effort : undefined;
106106
logCtx.requestedEffort = from;
107107
// Compaction is normally excluded by native-route eligibility; preserve that boundary here too.
108-
const pinned = chatBody.compaction_trigger === undefined
108+
const compaction = chatBody.compaction_trigger !== undefined;
109+
const pinned = !compaction
109110
? resolvePinnedEffort(route, selector, config)
110111
: undefined;
112+
let normalizeForWire = false;
111113
if (pinned !== undefined) {
112114
logCtx.requestedEffort = from ? `${from}->${pinned}` : pinned;
113115
if (pinned === "none") delete chatBody.reasoning_effort;
114116
else chatBody.reasoning_effort = pinned;
115-
// The native lane historically passes caller effort through, including with caps set.
116-
// Only a newly operator-pinned value enters the cap and provider-mapping pipeline.
117-
if (effortCapAppliesTo(chatCollabSurface(chatBody), req.headers, config)) {
118-
const capped = applyChatEffortCap(chatBody, req.headers, config, supportedLadderFor(route));
119-
if (capped) logCtx.requestedEffort = `${logCtx.requestedEffort}->${capped.to}`;
117+
normalizeForWire = true;
118+
}
119+
// A qualifying turn's ceiling is independent of whether an operator pin resolved.
120+
if (effortCapAppliesTo(chatCollabSurface(chatBody), req.headers, config, compaction)) {
121+
const capped = applyChatEffortCap(chatBody, req.headers, config, supportedLadderFor(route));
122+
if (capped) {
123+
logCtx.requestedEffort = `${logCtx.requestedEffort ?? capped.from}->${capped.to}`;
124+
normalizeForWire = true;
120125
}
126+
}
127+
// Normalize operator-pinned values and cap rewrites; otherwise preserve caller spelling.
128+
if (normalizeForWire) {
121129
const effort = typeof chatBody.reasoning_effort === "string" ? chatBody.reasoning_effort : undefined;
122130
const wireEffort = mapReasoningEffort(route.provider, route.modelId, effort);
123131
if (wireEffort === undefined) delete chatBody.reasoning_effort;

‎structure/adapters/registry.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ see [Combo editor routing quota](../gui-and-management-api.md#combo-editor-routi
7070

7171
Claude replay carries [Go conversation affinity](../data-planes/inbound-compat.md#claude-affinity-at-final-go-dispatch)
7272
privately to final dispatch; preliminary route selection does not inject Go-only headers.
73+
Native Chat applies qualifying effort ceilings independently of model pins; pin selection precedes the cap and only pins or cap rewrites enter wire mapping. The [catalog effort contract](../catalog.md#ultra-reasoning-level) records the V1/compaction exemptions and caller-preservation boundary.

0 commit comments

Comments
 (0)