Repository navigation
fix(middleware): 隐藏无可用渠道错误中的任务插件标识 - #7414
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughTask-plugin routing details are removed from public 503 messages. The distributor now records those details in server logs. English, Simplified Chinese, and Traditional Chinese messages and distributor tests were updated. ChangesTask-plugin diagnostics
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Plugin routing keys are removed from public 503 responses while server diagnostics retain them for request-ID-based troubleshooting. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit reads each line, Comment |
|
这样诊断信息就太少了,连是不是插件都无法知道 |
… plugin keys The fully generic message from QuantumNous#7414 left callers and operators unable to tell whether a task plugin was involved at all. Restore the group, model and plugin-claimed wording in the 503 body, but keep the plugin keys and the admin fix hint out of it; the candidate plugin keys stay in the warn log under the request id so operators can correlate.
* fix(middleware): 隐藏无可用渠道错误中的任务插件标识 * fix(middleware): keep task-plugin context in no-channel error without plugin keys The fully generic message from QuantumNous#7414 left callers and operators unable to tell whether a task plugin was involved at all. Restore the group, model and plugin-claimed wording in the 503 body, but keep the plugin keys and the admin fix hint out of it; the candidate plugin keys stay in the warn log under the request id so operators can correlate. --------- Co-authored-by: 老黑 <67053678+blackdm666@users.noreply.github.com> Co-authored-by: CaIon <i@caion.me>
* fix(middleware): 隐藏无可用渠道错误中的任务插件标识 * fix(middleware): keep task-plugin context in no-channel error without plugin keys The fully generic message from QuantumNous#7414 left callers and operators unable to tell whether a task plugin was involved at all. Restore the group, model and plugin-claimed wording in the 503 body, but keep the plugin keys and the admin fix hint out of it; the candidate plugin keys stay in the warn log under the request id so operators can correlate. --------- Co-authored-by: CaIon <i@caion.me>
* fix(middleware): 隐藏无可用渠道错误中的任务插件标识 * fix(middleware): keep task-plugin context in no-channel error without plugin keys The fully generic message from QuantumNous#7414 left callers and operators unable to tell whether a task plugin was involved at all. Restore the group, model and plugin-claimed wording in the 503 body, but keep the plugin keys and the admin fix hint out of it; the candidate plugin keys stay in the warn log under the request id so operators can correlate. --------- Co-authored-by: CaIon <i@caion.me>
* fix(middleware): 隐藏无可用渠道错误中的任务插件标识 * fix(middleware): keep task-plugin context in no-channel error without plugin keys The fully generic message from QuantumNous#7414 left callers and operators unable to tell whether a task plugin was involved at all. Restore the group, model and plugin-claimed wording in the 503 body, but keep the plugin keys and the admin fix hint out of it; the candidate plugin keys stay in the warn log under the request id so operators can correlate. --------- Co-authored-by: CaIon <i@caion.me>
* fix(middleware): 隐藏无可用渠道错误中的任务插件标识 * fix(middleware): keep task-plugin context in no-channel error without plugin keys The fully generic message from QuantumNous#7414 left callers and operators unable to tell whether a task plugin was involved at all. Restore the group, model and plugin-claimed wording in the 503 body, but keep the plugin keys and the admin fix hint out of it; the candidate plugin keys stay in the warn log under the request id so operators can correlate. --------- Co-authored-by: CaIon <i@caion.me>
Agent
Links
69a50029819a26c53e6babd276d49cfe2f8880ad。User request
用户发现“无可用渠道”错误将任务插件标识返回给调用者,并指出:“那插件名字就不能写我的渠道名了,直接就暴露给用户了呀”。随后要求:“你把这个提交一个PR,用中文,按仓库格式提交。”用户已明确选择提交到官方仓库。
Out of scope — refuse
Kind
Issue facts
error.message包含插件meta.key、内部组名,以及在管理控制台停用或覆盖插件的操作建议。多个插件共享模型时,还会列出全部候选插件标识。middleware/distributor.go的noAvailableChannelMessage()将插件标识传入后端翻译模板,随后由abortWithOpenAiMessage()返回给调用者。测试直接执行Distribute(),没有调用客户端或上游服务即可复现。error.message。保留 HTTP 503、new_api_error、model_not_found及请求 ID。billing、frontend、deployment 不适用,本 PR 不改动这些路径。Change
任务插件没有可用渠道时,对外统一返回本地化的通用提示;简体中文为“当前模型暂无可用渠道,请稍后重试或联系客服。”,请求 ID 继续由原有错误响应流程附加。
插件标识、分组和模型转入服务端告警日志,记录
event=no_available_channel与reason=no_eligible_channel,并由现有日志器关联请求 ID。共享模型仍保留全部候选插件,管理员可以据此排查。日志字段使用%q引用,避免直接拼接未经引用的字段。Research
Duplicate / prior art
QuantumNous/new-api检索"no available channel" "plugin"、"distributor" "plugin"、"no_available_channel_task_plugin"、"plugin" "error"、"plugin" "expose"、"插件" "泄露"、"noAvailableChannelMessage"。Docs and code
AGENTS.md、docs/plugin-api/v1.md和本 PR 模板;改动位于宿主错误提示,不更改插件 API、元数据或协议。middleware/distributor.go生成可用渠道错误;middleware/utils.go保持错误码、状态码与请求 ID;logger/logger.go提供带请求 ID 的服务端日志;三份后端语言文件包含原始泄露文案。Alternatives considered
Files
middleware/distributor.gomiddleware/distributor_test.goi18n/locales/en.yamli18n/locales/zh-CN.yamli18n/locales/zh-TW.yamlBehavior
private-provider-alpha、内部组名以及停用或覆盖插件的建议;共享模型还会暴露其他候选插件。Verification
go test ./middleware -run '^TestDistributeHidesTaskPluginDetailsButLogsDiagnostics$' -count=1:旧代码 6 个场景失败,失败响应包含内部标识;应用修复后同一命令通过。go test ./middleware ./i18n ./pkg/jsplugin ./relay/channel/task/jsplugin ./relay:通过;i18n没有独立测试文件,三语言翻译由 middleware 回归实际加载并验证。go vet ./middleware ./i18n:通过。gofmt与git diff --check:通过。httptest驱动真实RequestId()、Distribute()和错误封装验证,未发付费上游请求。model_not_found、请求 ID、全部候选插件的服务端日志,以及不可继续进入 relay handler。保留无插件回退测试;共享插件重绑定测试不再断言对外公开插件名。Risks
Scope check
Summary by CodeRabbit