Skip to content

fix: 移除 responses/compact 端点的 API type 白名单限制 - #6462

Closed
fangzhengjin wants to merge 1 commit into
QuantumNous:mainfrom
fangzhengjin:fix/remove-compact-api-type-whitelist
Closed

fix: 移除 responses/compact 端点的 API type 白名单限制#6462
fangzhengjin wants to merge 1 commit into
QuantumNous:mainfrom
fangzhengjin:fix/remove-compact-api-type-whitelist

Conversation

@fangzhengjin

@fangzhengjin fangzhengjin commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

移除 relay/responses_handler.go/v1/responses/compact 端点的 API type 白名单(仅允许 OpenAI/Codex 通过)。

该白名单与适配器层校验完全重叠——不支持 Responses 的适配器会在 ConvertOpenAIResponsesRequest 中自行报错,
白名单只是把更精准的适配器错误替换成了笼统的 "unsupported endpoint for api type X"

AdvancedCustom 适配器已完整实现 Responses 处理链,却被白名单拦截在适配器之前,属于遗漏。
删除后,AdvancedCustom 渠道在 converter=none 模式下可正常使用 compact 端点,其他不支持的适配器仍会自然报错,行为不变。

下游 compact 逻辑(后缀处理、定价 fallback、计费)本身不区分 API type,无需联动修改。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • Bug Fixes
    • Compact relay mode requests are no longer rejected upfront based solely on their API type.
    • These requests now follow the same standard request parsing, model mapping, upstream handling, and response processing flow as other supported variants, improving reliability for compact request payloads.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8fb2370d-1d35-4114-8099-600803216362

📥 Commits

Reviewing files that changed from the base of the PR and between fe197c3 and cec2e64.

📒 Files selected for processing (1)
  • relay/responses_handler.go
💤 Files with no reviewable changes (1)
  • relay/responses_handler.go

Walkthrough

The compact Responses relay path no longer applies an early API type allowlist. Requests proceed to request construction and downstream parsing, model mapping, upstream adaptation, and response handling.

Changes

Compact Responses relay

Layer / File(s) Summary
Remove compact endpoint allowlist
relay/responses_handler.go
Removes the unused import and the 400 invalid-request guard that rejected compact relay requests for API types other than OpenAI and Codex.

Estimated code review effort: 2 (Simple) | ~5 minutes

Poem

A rabbit hops through compact streams,
No gate now blocks the Responses dreams.
The request proceeds along its way,
Past the old guard from yesterday.
Hop hop—the flow is neat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: removing the API type whitelist for the responses/compact endpoint.
Linked Issues check ✅ Passed The change removes the blocking whitelist so /v1/responses/compact can reach the existing adapter path, matching #6461's requested behavior.
Out of Scope Changes check ✅ Passed The PR is narrowly scoped to the whitelist removal and cleanup of its now-unused import.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seefs001

Copy link
Copy Markdown
Collaborator

这个删了会无法编译通过,需要清理一下import

@fangzhengjin
fangzhengjin force-pushed the fix/remove-compact-api-type-whitelist branch from e16203f to fe197c3 Compare July 27, 2026 06:24
@fangzhengjin
fangzhengjin force-pushed the fix/remove-compact-api-type-whitelist branch from fe197c3 to cec2e64 Compare July 27, 2026 06:27
@fangzhengjin

Copy link
Copy Markdown
Contributor Author

这个删了会无法编译通过,需要清理一下import

@seefs001 已本地测试编译通过

@fangzhengjin
fangzhengjin deleted the fix/remove-compact-api-type-whitelist branch July 27, 2026 07:26
@coderabbitai coderabbitai Bot mentioned this pull request Jul 31, 2026
11 tasks
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.

[BUG] 高级自定义渠道类型 /v1/responses/compact 端点兼容问题

2 participants