Repository navigation
fix(api): grant in-run tool files to later workflow nodes - #41300
Merged
crazywoola merged 1 commit intoSep 21, 2026
Merged
crazywoola merged 1 commit into
crazywoola merged 1 commit into
Conversation
When a workflow is invoked as a tool from an Agent, plugin downloads often store ToolFile.user_id as a different identity than the chatting end user. Later LLM nodes then fail the ownership filter and drop the image, so the vision prompt has no user file. Mirror the existing upload-file grant: ToolFileMessageTransformer records produced tool_file_ids on the current FileAccessScope so build_from_mapping can attach them without weakening ungranted access. Fixes langgenius#41169
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-08-26 07:49:54.794407111 +0000
+++ /tmp/pyrefly_pr.txt 2026-08-26 07:49:40.927368017 +0000
@@ -6801,11 +6801,11 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `controller` with type `ToolProviderController[Unknown, Unknown]` in function `core.tools.utils.encryption.create_tool_provider_encrypter` [bad-argument-type]
--> tests/unit_tests/core/tools/utils/test_encryption.py:203:75
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/core/tools/utils/test_message_transformer.py:93:12
+ --> tests/unit_tests/core/tools/utils/test_message_transformer.py:95:12
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/core/tools/utils/test_message_transformer.py:94:12
+ --> tests/unit_tests/core/tools/utils/test_message_transformer.py:96:12
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/core/tools/utils/test_message_transformer.py:137:12
+ --> tests/unit_tests/core/tools/utils/test_message_transformer.py:139:12
ERROR Class member `_TestHitCallback.on_query` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
--> tests/unit_tests/core/tools/utils/test_misc_utils_extra.py:128:9
ERROR Class member `_TestHitCallback.on_tool_end` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -8067,11 +8067,11 @@
ERROR Generator function should return `Generator` [bad-return]
--> tests/unit_tests/extensions/test_workflow_warm_shutdown.py:13:36
ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
- --> tests/unit_tests/factories/test_build_from_mapping.py:69:58
+ --> tests/unit_tests/factories/test_build_from_mapping.py:74:58
ERROR Object of class `NoneType` has no attribute `storage_key` [missing-attribute]
- --> tests/unit_tests/factories/test_build_from_mapping.py:148:12
+ --> tests/unit_tests/factories/test_build_from_mapping.py:153:12
ERROR Object of class `NoneType` has no attribute `storage_key` [missing-attribute]
- --> tests/unit_tests/factories/test_build_from_mapping.py:180:12
+ --> tests/unit_tests/factories/test_build_from_mapping.py:185:12
ERROR Object of class `Dataset` has no attribute `embedding_available` [missing-attribute]
--> tests/unit_tests/fields/test_dataset_fields.py:212:5
ERROR Object of class `UploadFile` has no attribute `preview_url` [missing-attribute]
|
Contributor
Pyrefly Type Coverage
|
crazywoola
approved these changes
Sep 21, 2026
6 tasks done
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.
Important
Fixes #<issue number>.Summary
Fixes #41169
A workflow that downloads an image in a tool node and passes it to a later LLM vision node works in the orchestration test-run, but fails when the same published workflow is invoked as a tool from an Agent.
Orchestration binds an Account file-access scope, so plugin
ToolFilerows are readable. Agent chat binds an EndUser scope. Plugin uploads (/files/upload/for-plugin) often storeToolFile.user_idas a different identity than the chatting end user, so laterbuild_from_mappinglookups fail the ownership filter and the LLM prompt has no image (files: []).This change mirrors the existing upload-file grant:
ToolFileMessageTransformerrecords producedtool_file_ids on the currentFileAccessScope. Later nodes in the same execution can attach those files. Ungranted tool files still require matchinguser_id.This is the nested-workflow internal file path. It does not change how the Agent App converts tool results to chat text (#40425 / PR #40455).
Screenshots
Not applicable (backend file-access grant).
Checklist
test_build_from_mapping.py,test_message_transformer.py, FileAccessScope-related tests)