Skip to content

fix(openai): 思考关闭档位按模型夹取(Responses 路径) - #192

Merged
Slacker-LLC merged 1 commit into
mainfrom
fix/off-effort-clamp
Oct 10, 2026
Merged

Slacker-LLC merged 1 commit into
mainfrom
fix/off-effort-clamp

Conversation

@Slacker-LLC

Copy link
Copy Markdown
Owner

问题

Responses 路径下思考关闭时,请求带 reasoning.effort: "none"。只声明了 low…max 的模型(如 GPT-6 Astra)不接受 "none",直接 400;上下文压缩用的就是"关闭思考",所以每次压缩(包括减半重试)都死在这个参数上,而不是死在长度上。

原因

"关闭"的取值按端点决定(官方 OpenAI → none),从来没有对照模型自己声明的档位检查。OpenMinis 1.14(上游 #377)已修,我们缺这一处。

改动

  • ThinkingRuleResolver.clampOffEffort(取自上游):模型声明了档位且不含请求值时,取声明里最低的一档;模型没有声明档位,或声明里已经有该值,则原样返回。刻意不用现有的 clampEffort,它会先往下再往上取档,["high","max"] 的模型会把"关闭"变成 high。
  • OpenAIProviderResponses.kt 的"关闭"分支改用它。Chat Completions 路径本来就只在声明里含有该值时才发,不用改。

测试

  • OffEffortClampTest(7 个,取自上游):报告的场景、含 none 的模型保持 none、无声明保持原样、不会升到高档、声明顺序无关、Ark 的 minimal、无法识别的声明不乱猜。
  • 新增 ResponsesOffEffortWireTest(3 个):真实 Responses 请求体中,只声明 low…max 的模型得到 low;声明含 none 的得到 none(否定);没有声明档位的仍是 none(否定)。
  • 思考相关的现有测试(含线上格式快照)全部通过。

未验证

没有用真实的 GPT-6 Astra 账号复现原来的 400。

🤖 Generated with Claude Code

https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3


Generated by Claude Code

…on the Responses path

Official OpenAI's off tier is "none", chosen by endpoint and never checked against the
model. A model declaring only low..max (gpt-6-astra) rejects it with HTTP 400, so every
compaction died on the parameter rather than its size. Port ThinkingRuleResolver.clampOffEffort
from OpenMinis 1.14: the lowest declared tier, never a higher one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PV4ECd3Yzu9k81sw7vHjS3
@Slacker-LLC
Slacker-LLC merged commit 5e5a569 into main Oct 10, 2026
14 checks passed
@Slacker-LLC
Slacker-LLC deleted the fix/off-effort-clamp branch October 10, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants