mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-21 09:09:53 +00:00
Codex Desktop 内置的 automation_update 工具会带 parameters.type = null, OpenAI 直接回 400 invalid_function_parameters,而网关把该状态归一成可重试的 502 upstream_error。该工具定义还会沉进多轮会话历史,之后每一轮都继续失败, 同一份坏 Schema 在账号池里被反复重放。 在 OpenAIGatewayService.Forward 分流到 passthrough / Codex transform / 原生 ChatCompletions 之前,统一把显式为 null 的 parameters.type 补成 "object",覆盖顶层 tools[] 与多轮历史里 input[].tools[] 的嵌套工具定义。 只修正显式 null:缺失 type 的 Schema 本身合法,补写会收窄客户端语义, 因此保持原样。 Fixes #5364