fix: preserve original name for warning in transform_string_function_style#2952
fix: preserve original name for warning in transform_string_function_style#2952kuishou68 wants to merge 1 commit intoopenai:mainfrom
Conversation
…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>
|
Thanks for the report and the patch. The issue is valid: names with spaces are currently transformed before the warning comparison, so something like 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: 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. |
Closes #2951
Problem
transform_string_function_stylemodifiedname(replacing spaces with_) before comparing it totransformed_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 = namebefore 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