fix: sanitize agent names for OpenAI messages#2361
Open
DevanshuRawal wants to merge 1 commit into
Open
Conversation
Collaborator
|
CLA Not Signed The Contributor License Agreement (CLA) check is currently pending on this PR ( @DevanshuRawal please sign the CLA via the CLA assistant badge in the comment above, or visit https://cla-assistant.io/agentscope-ai/agentscope-java. Once signed, the Automated check by github-manager-bot |
Author
|
Hi maintainers, just following up on this PR when you get a chance. All CI checks and the CLA check are passing. Thank you for your time and review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
2.0.1-SNAPSHOT
Description
This PR fixes an issue where agent/message names containing spaces or other special characters could be rejected by OpenAI-compatible APIs.
The message name is now sanitized before being assigned to the OpenAI message DTO. Characters other than letters, numbers, underscores, and hyphens are replaced with underscores. This sanitization is applied to both user and assistant messages.
Changes
sanitizeMessageNamehelper method.Testing
mvn spotless:applymvn -pl agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-openai -am -DskipTests compile✅mvn -pl agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-openai -am testThe targeted build and compilation pass successfully. The full test command is currently blocked by two existing Windows symlink permission errors in
DangerousPathBypassTest(A required privilege is not held by the client).Checklist
mvn spotless:applymvn test) — 2 Windows symlink permission errors occurred