Skip to content

fix(guardrails): resolve tool guardrails on tools named with special characters [AL-610] - #1114

Merged
andreizdrali-uipath merged 3 commits into
mainfrom
fix/guardrail-match-names-sanitized-al-610
Sep 25, 2026
Merged

andreizdrali-uipath merged 3 commits into
mainfrom
fix/guardrail-match-names-sanitized-al-610

Conversation

@andreizdrali-uipath

@andreizdrali-uipath andreizdrali-uipath commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes AL-610, found while testing AL-607.

Problem

A custom Tool-scope guardrail with an "all fields" rule fails agent startup with INVALID_GUARDRAIL_CONFIG ("Tool 'My Function' not found in available tools") when the tool's name has a space or special character, or is longer than 64 characters. _compute_field_sources_for_guardrail compares the selector's name as typed (My Function) with the sanitized tool name (My_Function). The selector is sanitized only after the rules are converted.

The display_name fallback only helps when it holds the raw tool name, as it does for integration tools. It doesn't for:

  • process, agent, API, flow and function tools, where it holds the process name (Function_1)
  • built-in tools such as Analyze Files, where it holds the sanitized name
  • IXP tools, where it holds the app name
  • client-side tools, which have no display_name

Fix

Compare sanitize_tool_name(match_name) with t.name, and keep the raw display_name fallback that MCP tools rely on. The subgraph already matches the guardrail to the tool by this sanitized name, and the C# runtime compares names the same way.

No agent that starts today fails after this change: every tool factory registers its tool under a sanitized name, so any selector that matched t.name before still matches it. Voice agents rebuild guardrails on every tool call, so with such a guardrail every voice tool call failed; they now work too.

Bumps to 0.18.15.

Tests

  • New: an all-fields rule on a process tool named My Function and Send E-mail (v2)! (both failed before the fix), plus an MCP display-name case to guard the fallback.
  • uv run pytest: 3455 passed, 3 skipped, 2 failed. Both failures are in test_output_file_tool.py and also fail on main on Windows (CSV MIME type from the registry, symlink privilege).
  • just lint, just format and mypy are clean.
  • tested using UiPath CLI, the new version is working as expected

🤖 Generated with Claude Code

…characters

A custom Tool-scope guardrail with an all-fields rule failed agent startup
with INVALID_GUARDRAIL_CONFIG when the tool's name had a space or special
character. The selector holds the name as typed ("My Function"), tools are
registered sanitized ("My_Function"), and the selector is only sanitized
after the rules are converted. Process tools' display_name is the process
name, so that fallback did not match either.

Compare the sanitized match name with the tool name, keeping the
display_name fallback that MCP tools rely on.

Fixes AL-610.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andreizdrali-uipath
andreizdrali-uipath marked this pull request as ready for review September 24, 2026 12:55
Copilot AI lite review requested due to automatic review settings September 24, 2026 12:55
@andreizdrali-uipath andreizdrali-uipath changed the title fix(guardrails): resolve tool guardrails on tools named with special characters fix(guardrails): resolve tool guardrails on tools named with special characters [AL-610] Sep 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Resolve the ambiguous display-name versus sanitized-name tool matching before approval.

Review effort: Lite
Findings: None

What changed in this PR

Fixes tool guardrail resolution for tool names containing spaces or special characters.

Changes:

  • Matches selectors against sanitized tool names.
  • Preserves MCP display-name fallback.
  • Adds regression tests and bumps version to 0.18.15.
File Description
uv.lock Updates locked package version.
tests/​agent/​guardrails/​test_guardrails_factory.py Adds process-tool and MCP matching tests.
src/​uipath_langchain/​agent/​guardrails/​guardrails_factory.py Resolves sanitized tool selectors.
pyproject.toml Bumps package version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/uipath_langchain/agent/guardrails/guardrails_factory.py Outdated
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andreizdrali-uipath
andreizdrali-uipath enabled auto-merge (squash) September 25, 2026 11:29
@sonarqubecloud

Copy link
Copy Markdown

@andreizdrali-uipath
andreizdrali-uipath merged commit 1e8b45e into main Sep 25, 2026
48 checks passed
@andreizdrali-uipath
andreizdrali-uipath deleted the fix/guardrail-match-names-sanitized-al-610 branch September 25, 2026 12:21
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.

3 participants