-
-
Notifications
You must be signed in to change notification settings - Fork 181
Fix #541: Add error rule for Codex reasoning effort mismatch #544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -705,6 +705,24 @@ const DEFAULT_ERROR_RULES = [ | |
| }, | ||
| }, | ||
| }, | ||
| // Issue #541: Codex model reasoning effort mismatch | ||
| { | ||
| pattern: "Unsupported value.*is not supported with.*model.*Supported values", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [High] [LOGIC-BUG] Regex pattern is too broad and can misclassify unrelated “Unsupported value” errors Evidence ( pattern: "Unsupported value.*is not supported with.*model.*Supported values",…and the override message is reasoning-effort specific ( Why this is a problem: That error string format is generic (many OpenAI/Codex invalid_request_error cases use “Unsupported value … Supported values …”). With the current pattern, unrelated unsupported-value errors (e.g. other params) will be overridden with a reasoning_effort troubleshooting message, hiding the real cause and misleading users. Suggested fix (tighten the regex to require a reasoning-effort signal from the upstream body): {
// ...
pattern:
"(\\\"param\\\"\\s*:\\s*\\\"reasoning_effort\\\"|reasoning_effort).*Unsupported value.*is not supported with.*model.*Supported values",
category: "thinking_error",
// ...
} |
||
| category: "thinking_error", | ||
| description: "Reasoning effort (thinking intensity) not supported by the Codex model", | ||
| matchType: "regex" as const, | ||
| isDefault: true, | ||
| isEnabled: true, | ||
| priority: 72, | ||
| overrideResponse: { | ||
| type: "error", | ||
| error: { | ||
| type: "thinking_error", | ||
| message: | ||
| "当前思考强度不支持该模型,请调整 reasoning_effort 参数或切换模型(如 'high' 仅支持部分模型)", | ||
| }, | ||
| }, | ||
| }, | ||
|
Comment on lines
+708
to
+725
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # 查看文件大小和结构
wc -l src/repository/error-rules.tsRepository: ding113/claude-code-hub Length of output: 100 🏁 Script executed: # 查看 708-725 行的代码
sed -n '700,730p' src/repository/error-rules.ts | cat -nRepository: ding113/claude-code-hub Length of output: 1026 🏁 Script executed: # 查看周围的错误规则以验证优先级顺序
sed -n '690,740p' src/repository/error-rules.ts | cat -nRepository: ding113/claude-code-hub Length of output: 1670 🏁 Script executed: # 搜索所有 thinking_error 分类的规则及其优先级
rg -n --type ts 'thinking_error' src/repository/error-rules.ts -B5 -A10Repository: ding113/claude-code-hub Length of output: 2242 🏁 Script executed: # 搜索 reasoning_effort 相关的代码
rg -n --type ts 'reasoning_effort' --max-count=20Repository: ding113/claude-code-hub Length of output: 2843 🏁 Script executed: # 检查是否有其他 Codex 或思维强度相关的错误规则
rg -n --type ts 'Codex|reasoning.*effort' src/repository/error-rules.ts -B2 -A2Repository: ding113/claude-code-hub Length of output: 593 🏁 Script executed: # 检查第 722 行的精确字符数
sed -n '722p' src/repository/error-rules.ts | wc -cRepository: ding113/claude-code-hub Length of output: 70 🏁 Script executed: # 查看第 721-723 行的完整内容
sed -n '721,723p' src/repository/error-rules.tsRepository: ding113/claude-code-hub Length of output: 165 🏁 Script executed: # 查找 ClaudeErrorResponse 接口定义
rg -n --type ts 'interface ClaudeErrorResponse|type ClaudeErrorResponse' -A10Repository: ding113/claude-code-hub Length of output: 701 🏁 Script executed: # 搜索所有 thinking_error 类别的规则,看是否有其他需要同步的地方
rg -n 'thinking_error' src/repository/error-rules.ts -B1 -A1Repository: ding113/claude-code-hub Length of output: 892 🏁 Script executed: # 检查周围 70-80 优先级范围内的规则
sed -n '600,730p' src/repository/error-rules.ts | grep -n 'priority'Repository: ding113/claude-code-hub Length of output: 215 🏁 Script executed: # 再确认一下完整的第 722 行内容和缩进情况
sed -n '720,724p' src/repository/error-rules.ts | cat -ARepository: ding113/claude-code-hub Length of output: 511 🏁 Script executed: # 检查是否有其他行也超过了 100 字符限制
awk 'NR>=708 && NR<=725 && length($0) > 100 {print NR": "length($0)" chars - "$0}' src/repository/error-rules.tsRepository: ding113/claude-code-hub Length of output: 156 修复行长度超限问题 新增的错误规则实现质量整体良好,但存在一个代码风格违规: ❌ 行长度超限:第 722 行有 138 个字符,超过编码规范规定的 100 字符限制。需要拆分长字符串: 建议修复方案message:
"当前思考强度不支持该模型,请调整 reasoning_effort 参数或" +
"切换模型(如 'high' 仅支持部分模型)",或使用模板字符串分行: message:
`当前思考强度不支持该模型,请调整 reasoning_effort 参数或切换模型` +
`(如 'high' 仅支持部分模型)`,✅ 其他方面正确:2 空格缩进、双引号、尾随逗号、正则模式、分类(thinking_error)、优先级位置(72,介于 71 和下一级之间)、ClaudeErrorResponse 接口格式都符合规范。 🤖 Prompt for AI Agents |
||
| ]; | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current regex pattern is a bit broad and could potentially match other unrelated error messages, leading to incorrect error handling. It's better to make it more specific to the exact error format to increase robustness and prevent future false positives. This can be done by explicitly matching the quotes and punctuation from the example error message.