Skip to content

Fix tool schema normalization to always remove nested function field#13

Draft
Copilot wants to merge 7 commits intofix/codex-tools-compatfrom
copilot/sub-pr-12
Draft

Fix tool schema normalization to always remove nested function field#13
Copilot wants to merge 7 commits intofix/codex-tools-compatfrom
copilot/sub-pr-12

Conversation

Copy link

Copilot AI commented Feb 17, 2026

The normalization logic had early returns that allowed tools with both top-level name and nested function fields to pass through unchanged, sending malformed schemas to Codex.

Changes

  • Removed premature early returns in normalizeCodexToolChoice and normalizeCodexTools that skipped normalization when top-level name existed
  • Always delete function field when present, regardless of top-level field state
  • Prefer non-empty top-level name over nested function.name, with proper empty string handling

Example

Before, this tool would pass through with the function field intact:

{
  type: "function",
  name: "legacy_tool",  // Top-level name exists
  function: {           // This would NOT be removed
    name: "nested_name"
  }
}

After normalization, the function field is always removed:

{
  type: "function",
  name: "legacy_tool"  // Keeps top-level name, function field removed
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 6 commits February 17, 2026 16:34
Co-authored-by: 0x4007 <4975670+0x4007@users.noreply.github.com>
Co-authored-by: 0x4007 <4975670+0x4007@users.noreply.github.com>
Co-authored-by: 0x4007 <4975670+0x4007@users.noreply.github.com>
Co-authored-by: 0x4007 <4975670+0x4007@users.noreply.github.com>
Co-authored-by: 0x4007 <4975670+0x4007@users.noreply.github.com>
Co-authored-by: 0x4007 <4975670+0x4007@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 17, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.deno.land
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix Codex tool schema compatibility Fix tool schema normalization to always remove nested function field Feb 17, 2026
Copilot AI requested a review from 0x4007 February 17, 2026 16:40
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.

2 participants