Skip to content

fix: never send the solution_folder sentinel as a folder path - #1044

Open
Chibionos wants to merge 1 commit into
mainfrom
fix/solution-folder-sentinel
Open

fix: never send the solution_folder sentinel as a folder path#1044
Chibionos wants to merge 1 commit into
mainfrom
fix/solution-folder-sentinel

Conversation

@Chibionos

Copy link
Copy Markdown
Contributor

Problem

create_process_tool treats resource.properties.folder_path as a real folder path. For solution-local resources that value is the literal string solution_folder — a packager sentinel meaning "no folder" (SOLUTION_FOLDER_SENTINEL in the agents repo, packages/agents-packager/src/bindings/handlers/common.ts, documented there as "treat as 'no folder', same as null/empty"). The packager omits folderPath from generated bindings when it sees that value, but never strips it from agent.json, so it reaches the runtime.

The fallback chain added in #1038 is:

folder_path = get_execution_folder_path() or resource.properties.folder_path
folder_key  = get_execution_folder_key() if not folder_path else None

With UIPATH_FOLDER_PATH unset and a solution-local resource, folder_path becomes the truthy string "solution_folder", so:

  1. StartJobs goes out with X-UIPATH-FolderPath: solution_folder, a folder that does not exist for the solution; and
  2. because it is truthy, folder_key is forced to None, so UIPATH_FOLDER_KEY is never consulted — and the platform client's env-level FolderContext header (_folder_context.py), which applied before fix: process tool folder fallback when UIPATH_FOLDER_PATH is unset #1038 when header_folder(None, None) returned {}, is bypassed too.

Net effect: for solution-local tools #1038 narrowed the reachable folder set rather than widening it.

Verified in the agents repo that this is a real hazard rather than theoretical: tenants accumulate folders literally named solution_folder, solution_folder 1, … so a path-based lookup on the sentinel can bind to an unrelated solution's folder.

Fix

Map the sentinel to None before resolving, mirroring the packager's own rule. Precedence is otherwise unchanged: UIPATH_FOLDER_PATH → resource folderPathUIPATH_FOLDER_KEY.

Testing

  • test_solution_folder_sentinel_is_not_a_folder_path — sentinel must not be sent as folder_path and must not shadow UIPATH_FOLDER_KEY.
  • test_env_folder_path_still_wins_over_sentinelUIPATH_FOLDER_PATH keeps precedence.
  • tests/agent/tools/test_process_tool.py: 31 passed; ruff check / ruff format --check clean.

Scope

This is a correctness/hardening fix. It is not by itself the fix for the agent-evaluation failures on solution-local workflow tools — in the eval path the shipped snapshot arrives with folder_path=None, so this code path is inert there; that root cause (eval jobs not carrying the debug context that lets solution-local workflows resolve) is tracked separately. Filing this on its own because the sentinel-as-folder-path behavior is wrong regardless.

Follow-up noted in #1038 still stands: context_tool.py, escalation_recipient.py, and escalation_tool.py do their own env-path-only resolution and should get the same treatment.

🤖 Generated with Claude Code

https://claude.ai/code/session_011ZRJcED9mUhXSTkmPSzgbx

The agents packager writes folderPath="solution_folder" into agent.json for
solution-local resources as a "no folder" sentinel. The fallback added in
#1038 forwarded it to StartJobs as a real folder header and shadowed the
UIPATH_FOLDER_KEY fallback, so solution-local tools failed in eval jobs even
after the fix. Map the sentinel to None before resolving the folder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ZRJcED9mUhXSTkmPSzgbx
Copilot AI lite review requested due to automatic review settings August 24, 2026 10:29
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

Pull request overview

This PR fixes folder resolution for process tools when a solution-local resource carries the packager sentinel folder path "solution_folder", ensuring the runtime never sends that sentinel as an actual Orchestrator folder path and that it doesn’t prevent UIPATH_FOLDER_KEY fallback from working.

Changes:

  • Normalize the "solution_folder" sentinel to None before folder resolution in create_process_tool().
  • Add regression tests ensuring the sentinel is never sent as folder_path and that UIPATH_FOLDER_PATH still takes precedence over the sentinel.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/uipath_langchain/agent/tools/process_tool.py Maps the packager sentinel "solution_folder" to None so it isn’t sent as a folder header and doesn’t block UIPATH_FOLDER_KEY fallback.
tests/agent/tools/test_process_tool.py Adds tests covering sentinel handling and precedence behavior for env folder path vs. sentinel.

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

@sonarqubecloud

Copy link
Copy Markdown

# ("no folder", same as null/empty) — never send it as a real folder path.
configured_folder_path = resource.properties.folder_path
if configured_folder_path == _SOLUTION_FOLDER_SENTINEL:
configured_folder_path = None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this check should happen upstream, in the low code package.
if someone builds a coded agent using this method they may end up with unexpected behaviour

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