Skip to content

fix: preserve original name for warning in transform_string_function_style#2952

Closed
kuishou68 wants to merge 1 commit intoopenai:mainfrom
kuishou68:fix/transform-space-warning
Closed

fix: preserve original name for warning in transform_string_function_style#2952
kuishou68 wants to merge 1 commit intoopenai:mainfrom
kuishou68:fix/transform-space-warning

Conversation

@kuishou68
Copy link
Copy Markdown
Contributor

Closes #2951

Problem

transform_string_function_style modified name (replacing spaces with _) before comparing it to transformed_name. This meant tool names containing only spaces (as invalid chars) never triggered the warning, even though the returned value silently differed from the original input.

Fix

Capture original_name = name before any mutation, and compare the final lowercased result against the original to decide whether to warn.

Signed-off-by: Cocoon-Break 54054995+kuishou68@users.noreply.github.com

…g_function_style

The function was replacing spaces with underscores before comparing whether
the name had been modified, so space-only transformations never triggered
the warning. This preserves the original name and compares the final
lowercased result to properly warn on all transformations.

Closes openai#2951

Signed-off-by: Cocoon-Break <54054995+kuishou68@users.noreply.github.com>
@seratch
Copy link
Copy Markdown
Member

seratch commented Apr 19, 2026

Thanks for the report and the patch. The issue is valid: names with spaces are currently transformed before the warning comparison, so something like My Tool becomes my_tool without warning.

I’m going to handle the fix on our side rather than asking you to keep iterating on this PR. The main reason is that the safest change is a little narrower than the current patch: we should warn when the name needed character replacement, but we should not start warning for case-only normalization.

For example, this PR would also warn for:

MyTool -> mytool
transfer_to_Agent -> transfer_to_agent

Those names only contain letters, digits, and underscores, so the existing “invalid characters” warning would be misleading. It could also add warning noise for common agent and handoff names where uppercase letters are normal.

#2953 keeps the existing returned values, adds the missing warning for spaces/punctuation, and adds regression coverage for both replacement and case-only cases. I’ll close this PR once that lands. Thanks again for surfacing the bug.

@seratch seratch closed this Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: transform_string_function_style silently transforms space-containing names without warning

2 participants