Skip to content

fix(codex): preserve and normalize additional_tools IDs - #8754

Merged
Wei-Shaw merged 2 commits into
Wei-Shaw:mainfrom
r266-tech:codex/preserve-additional-tools-id
Nov 16, 2026
Merged

Wei-Shaw merged 2 commits into
Wei-Shaw:mainfrom
r266-tech:codex/preserve-additional-tools-id

Conversation

@r266-tech

@r266-tech r266-tech commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

OAuth stateless-input cleanup drops input[].additional_tools.id. Losing that declaration identity can make native tool discovery return an ordinary function_call, which Codex rejects. The reporter's same-request comparison also shows that preserving a hyphenated UUID alone is insufficient in their OAuth scenario.

Preserve declaration IDs and compact only the strict at_<8-4-4-4-12 hex UUID> shape, for example at_00112233-4455-4677-8899-aabbccddeeff → at_00112233445546778899aabbccddeeff. Update matching item_reference IDs to declarations present in the same request, including references preceding declarations. Compact and opaque declaration IDs are retained; malformed, missing and non-string values are left for upstream validation.

Apply the same bounded conversion at the shared OAuth compatibility entry so ordinary and passthrough forwarding agree. The raw JSON path patches only relevant IDs, preserving unrelated large integers and escaped text; API Key compatibility requests keep their original IDs in this pass. Existing message/reasoning history cleanup remains covered.

Fixes #8752.

Validation (Go 1.27.3, macOS arm64):

  • 139 related tests/subtests passed. With the same new fixtures against the previous PR head fd648775810e, UUID filter/reference cases, the shared OAuth entry, and all eight ordinary/passthrough × Responses Lite on/off × streaming/buffered forwarding paths fail the new normalization expectations; API Key and malformed/opaque-ID controls pass.
  • go test -tags=unit ./... -count=1: 26,921 passed, 41 skipped.
  • go test -p=1 -tags=integration ./... -count=1: 16,185 passed, 16 skipped, using the repository's Docker PostgreSQL/Redis harness.
  • golangci-lint v2.14.0: 0 issues.

The existing backend-security failure on the previous head is GO-2026-6859 in net/http@go1.27.3; the separate Go 1.27.4 upgrade is #8670. Existing heap-growth and WS TTFT timing assertions failed in earlier local validation. Both assertions are unchanged, and the final full suites above passed.

AI-assisted implementation and local validation. The tests inspect outgoing request IDs and forward synthetic native tool_search_call responses. Live provider success comes from the reporter's comparison; I have not run a live OAuth/model request or Codex end-to-end test of this updated head.

@wanqiu410

wanqiu410 commented Nov 13, 2026 •

Copy link
Copy Markdown

我看了下,当前改法后我们环境仍可复现:
image
下图是本地改法
image

@r266-tech r266-tech changed the title fix(codex): preserve additional_tools declaration IDs fix(codex): preserve and normalize additional_tools IDs Nov 13, 2026
@r266-tech

Copy link
Copy Markdown
Contributor Author

已补上这次复测指出的 UUID 连字符差异,更新到 8dcdfff22。此前只保留声明 ID 确实漏了这一种真实输入形状。

现在对格式完整的 at_<8-4-4-4-12 十六进制 UUID> 去掉连字符,并同步更新同一请求里指向该声明的 item_reference。普通和透传 OAuth 路径都覆盖;紧凑/不透明 ID、无效值和未声明引用保持原有处理,其他历史项的 ID 清理规则不变。API Key 请求不进入这项 OAuth 规范化。

本地 Go 1.27.3 验证:完整 unit 26,921 通过、41 跳过;Docker PostgreSQL/Redis integration 16,185 通过、16 跳过;lint 0 问题。新增回归覆盖带/不带连字符、无效 ID、引用顺序、输入不变性,以及 8 条实际转发路径的出站 ID 和原生 tool_search_call 响应透传。旧 PR head 在这些规范化断言上失败,控制组通过。

这些是本地转换和模拟上游响应验证;本次未执行真实 OAuth/model 请求或 Codex 端到端测试。请用这个 head 复测原来的真实请求,确认原生 tool_search_call 是否恢复。旧 head 的安全 CI 日志已确认是 Go 1.27.3 的 GO-2026-6859,对应工具链升级仍在 #8670。

@Wei-Shaw
Wei-Shaw merged commit e16a349 into Wei-Shaw:main Nov 16, 2026
8 of 9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Codex 工具发现失败:OAuth 输入转换删除 additional_tools.id 后返回非原生工具调用,报 unsupported call

3 participants