fix: remove token sub_type inspection; accept run_as_me from caller#981
Open
maxduu wants to merge 1 commit into
Open
fix: remove token sub_type inspection; accept run_as_me from caller#981maxduu wants to merge 1 commit into
maxduu wants to merge 1 commit into
Conversation
The tool factory previously inferred RunAsMe by inspecting the token's sub_type claim (== "user"), which was misclassifying tokens and preventing RunAsMe from propagating to child process / API-workflow tool invocations. create_tools_from_resources now takes an explicit run_as_me: bool parameter. Callers resolve it from UiPathRuntimeContext.conversational_run_as_me (populated from fpsProperties.conversationalService.runAsMe on the harness side). Depends on: - UiPath/uipath-runtime-python#148 (adds the context field) - UiPath/uipath-agents-python (threads the value from context to caller) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 task
There was a problem hiding this comment.
Pull request overview
Removes implicit RunAsMe inference based on token claims and instead makes run_as_me an explicit input to create_tools_from_resources, ensuring the decision is owned by the caller (e.g., runtime context) and correctly propagates to process tool creation.
Changes:
- Deleted token
sub_typeinspection logic and the derivedrun_as_medecision insidecreate_tools_from_resources. - Added
run_as_me: bool = Falseparameter tocreate_tools_from_resourcesand threaded it through tocreate_process_tool. - Added tests verifying
run_as_me=Truepropagation and the defaultFalsebehavior.
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/tool_factory.py |
Adds explicit run_as_me parameter and forwards it to process tool creation; removes token-claim-based inference. |
tests/agent/tools/test_tool_factory.py |
Adds coverage to ensure run_as_me is forwarded and defaults to False when omitted. |
|
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.



Summary
create_tools_from_resourcespreviously inferredRunAsMeby inspecting the token'ssub_type == "user"claim, which was misclassifying tokens and preventingRunAsMefrom propagating to child process / API-workflow tool invocations.run_as_me: boolan explicit parameter oncreate_tools_from_resources. Callers resolve it fromUiPathRuntimeContext.conversational_run_as_me(populated fromfpsProperties.conversationalService.runAsMeon the harness side).Related PRs
Test plan
uv run pytest tests/agent/tools/test_tool_factory.py --no-cov— 15 passed (includes two new tests coveringrun_as_me=Truepropagation and theFalsedefault).uv run pytest tests/agent/tools/ --no-cov— 746 passed.just lintclean.🤖 Generated with Claude Code