Repository navigation
fix(translation): avoid Responses tool namespace collisions #1277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e1b5e90
88ab444
8fda5ab
f17689e
0a1d564
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| //! Reads the Codex tool namespaces that a Responses request decoder records. | ||
| //! | ||
| //! Codex groups tools into `namespace` containers. The Responses codec in | ||
| //! `switchyard-translation` flattens each child to `<namespace>__<tool>` and | ||
| //! `switchyard-translation` flattens each child to `<namespace>_sy_ns_<tool>` and | ||
| //! stores the mapping in the request's [`ProviderExtensions`]. Code that does not | ||
| //! depend on the translation crate uses these helpers to recover the tool name. | ||
|
|
||
|
|
@@ -13,7 +13,7 @@ use serde_json::{Map, Value}; | |
| use crate::ProviderExtensions; | ||
|
|
||
| /// Separator between a namespace and a tool name in a qualified wire name. | ||
| pub const NAMESPACE_SEPARATOR: &str = "__"; | ||
| pub const NAMESPACE_SEPARATOR: &str = "_sy_ns_"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prevent collisions when names contain the separator.
Use an unambiguous encoding, or reject collisions before sending the request.
|
||
|
|
||
| /// Request extension key holding the qualified-name to namespace mapping. | ||
| /// | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not treat a matching bare name as already qualified.
If namespace
mcp__docscontains a tool namedmcp__docs_sy_ns_search, the prefix check skips qualification. The Responses decoder recordsmcp__docs_sy_ns_mcp__docs_sy_ns_search, so a call returned under the shorter name cannot be restored to its namespace. (raw.githubusercontent.com)Qualify names from namespace containers without inferring qualification from the name prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR doesn't functionally change this method, it only removed a duplicate constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dagardner-nv You’re right that the prefix check itself was already present. I should have made that clear.
The replacement constant does change the separator from
__to_sy_ns_. That changes which bare names match the prefix check. The example in my comment is affected by that change, although the underlying check predates this PR.You are interacting with an AI system.