Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
27ee141c
Commit
27ee141c
authored
Apr 24, 2026
by
gaoren002
Browse files
fix(openai): preserve mcp tool call ids
parent
e65574de
Changes
2
Show whitespace changes
Inline
Side-by-side
backend/internal/service/openai_codex_transform.go
View file @
27ee141c
...
@@ -951,6 +951,7 @@ func isCodexToolCallItemType(typ string) bool {
...
@@ -951,6 +951,7 @@ func isCodexToolCallItemType(typ string) bool {
"local_shell_call"
,
"local_shell_call"
,
"tool_search_call"
,
"tool_search_call"
,
"custom_tool_call"
,
"custom_tool_call"
,
"mcp_tool_call"
,
"function_call_output"
,
"function_call_output"
,
"mcp_tool_call_output"
,
"mcp_tool_call_output"
,
"custom_tool_call_output"
,
"custom_tool_call_output"
,
...
...
backend/internal/service/openai_codex_transform_test.go
View file @
27ee141c
...
@@ -289,6 +289,38 @@ func TestApplyCodexOAuthTransform_PreservesFunctionCallInputName(t *testing.T) {
...
@@ -289,6 +289,38 @@ func TestApplyCodexOAuthTransform_PreservesFunctionCallInputName(t *testing.T) {
require
.
Equal
(
t
,
"fc1"
,
item
[
"call_id"
])
require
.
Equal
(
t
,
"fc1"
,
item
[
"call_id"
])
}
}
func
TestApplyCodexOAuthTransform_PreservesMCPToolCallIDAndName
(
t
*
testing
.
T
)
{
reqBody
:=
map
[
string
]
any
{
"model"
:
"gpt-5.4"
,
"input"
:
[]
any
{
map
[
string
]
any
{
"type"
:
"mcp_tool_call"
,
"call_id"
:
"call_abc"
,
"name"
:
"remote_tool"
,
"arguments"
:
"{}"
,
},
},
}
applyCodexOAuthTransform
(
reqBody
,
true
,
false
)
input
,
ok
:=
reqBody
[
"input"
]
.
([]
any
)
require
.
True
(
t
,
ok
)
require
.
Len
(
t
,
input
,
1
)
item
,
ok
:=
input
[
0
]
.
(
map
[
string
]
any
)
require
.
True
(
t
,
ok
)
require
.
Equal
(
t
,
"mcp_tool_call"
,
item
[
"type"
])
require
.
Equal
(
t
,
"remote_tool"
,
item
[
"name"
])
require
.
Equal
(
t
,
"fcabc"
,
item
[
"call_id"
])
}
func
TestCodexInputItemRequiresNameTypesAllowCallID
(
t
*
testing
.
T
)
{
for
_
,
typ
:=
range
[]
string
{
"function_call"
,
"custom_tool_call"
,
"mcp_tool_call"
}
{
require
.
True
(
t
,
codexInputItemRequiresName
(
typ
),
typ
)
require
.
True
(
t
,
isCodexToolCallItemType
(
typ
),
typ
)
}
}
func
TestApplyCodexOAuthTransform_ExplicitStoreFalsePreserved
(
t
*
testing
.
T
)
{
func
TestApplyCodexOAuthTransform_ExplicitStoreFalsePreserved
(
t
*
testing
.
T
)
{
// 续链场景:显式 store=false 不再强制为 true,保持 false。
// 续链场景:显式 store=false 不再强制为 true,保持 false。
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment