Repository navigation
fix(provider): stream Codex connection probes - #1508
Open
yoruuuchan wants to merge 1 commit into
Open
yoruuuchan wants to merge 1 commit into
yoruuuchan wants to merge 1 commit into
Conversation
ModelConfigConnectionTester ran both probes with stream = false, but the
Codex backend only accepts streaming requests ("Stream must be set to true").
Probe Codex with streaming; every other provider keeps the non-streaming
probe. The chat pipeline is untouched.
Fixes AAswordman#1490
CATMIAOZHI
self-requested a review
November 16, 2026 07:35
CATMIAOZHI
approved these changes
Nov 16, 2026
CATMIAOZHI
left a comment
Collaborator
There was a problem hiding this comment.
审计结论:✅ 批准合并
改动(1 个文件,+7/−2):ModelConfigConnectionTester 在探测前按 apiProviderType 计算 probeStream,OPENAI_CODEX 为 true,其他 provider 保持 false;chat、tool_call、图片/音频(复用 collectResponse)三类探测都使用该取值。
通过的检查:
- 目标分支为
dev,非草稿 PR,改动范围与 PR 描述一致,无关内容没有混入。 - 三处探测已全部覆盖:
collectResponse(chat 与图片/音频探测共用)与runToolCallTest均改用probeStream;文件内已无残留的stream = false。 probeStream取自configForTest.apiProviderType(config.copy(modelName = …)保留了 provider 类型),ApiProviderType.OPENAI_CODEX真实存在;其他 provider 的行为完全不变,聊天主链路未动。- 链路已核对:
stream参数经OpenAIResponsesProvider.createRequestBody→createRequestBodyInternal写入 Responses API 请求体;聊天主链路默认stream = true(AIService.kt:65、OpenAIProvider.kt:582),与 PR 所述「同一配置正常聊天可用」一致。设置页「测试连接」入口正是ModelConfigConnectionTester.run(ModelConfigScreen.kt:580),修的正是报 400 的路径。 - 无安全、权限、token 存储、UI 字符串方面的影响;
CancellationException仍原样 rethrow。 - 作者如实说明了验证边界:只跑了
git diff --check与仓库 hygiene 检查,未做 Gradle 构建、单元测试与真机验证(无 Codex OAuth 账号),需设备侧复测。
问题:
- [P3] 合并前请确认本 PR 的 Candidate checks 通过;设备侧复测(Codex 配置下 chat 与 tool_call 两项连接测试通过、其他 provider 探测行为不变)仍待验证,作者已在 PR 中说明,建议合并后由有 Codex 账号的维护者复测确认。
- [question] 本 PR 范围外的同类硬编码是否后续统一处理:
EnhancedAIService.callFunctionModel(EnhancedAIService.kt:722,标题/摘要等函数模型固定stream = false)与OpenAIProvider.testConnection(密钥池可用性探测固定stream = false)——Codex 配置若走到这些路径会遇到同样的 400。另,#1490 报告称正常聊天也会 400,但按当前代码聊天主链路默认流式、应可正常工作;若合并后 #1490 自动关闭前发现聊天仍有 400,请在 #1490 中补充复现信息另案处理。
后续可跟进(不阻塞):上述 [question] 的两处 stream = false 调用点可作为后续 issue 跟进,不影响本 PR 合并。
由 水晴喵的muse 审计
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明 / Description
背景与动机 / Context and motivation
Codex(
OPENAI_CODEX)模型配置的「测试连接」始终失败,返回 HTTP 400{"detail":"Stream must be set to true"},而同一配置正常聊天可用。原因是ModelConfigConnectionTester的两处探测都固定传入stream = false,Codex后端只接受流式请求。改动范围 / Changes
ModelConfigConnectionTester在探测前根据configForTest.apiProviderType计算probeStream:OPENAI_CODEX为true,其他 provider保持false。probeStream;复用collectResponse的媒体探测也随之使用同一取值。CodexProvider、其他 provider的探测方式。兼容性与风险 / Compatibility and risks
关联 Issue / Related issue
Fixes #1490
验证方式 / Verification
未运行 Gradle构建、单元测试与真机验证:仓库
AGENTS.md约定默认不执行编译/测试命令,且本机没有 Codex OAuth账号和 Android运行环境,无法端到端确认400消失。需要设备侧复测:Codex配置下 chat与 tool_call两项连接测试通过,其他 provider的探测保持原行为。PR的Candidate checks会随本 PR运行。证据 / Evidence
N/A(无 UI改动;改动内容见 diff)
检查清单 / Checklist
dev;如目标为main,我已说明这是维护者发布同步 / The target branch isdevfor regular work; if it ismain, I explained why this is a maintainer-led release syncCandidate checks覆盖改动范围,并会处理技术失败项 /Candidate checkscovers the change scope and technical failures will be addressed