Repository navigation
feat(agent): support batch config file uploads (SNP-997) - #44947
Merged
Merged
Conversation
zyssyz123
requested review from
hyoban,
iamjoel,
lyzno1 and
zxhlyh
as code owners
October 28, 2026 08:04
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #44947 +/- ##
===========================================
+ Coverage 59.62% 89.55% +29.93%
===========================================
Files 6011 6011
Lines 377116 377264 +148
Branches 76358 76386 +28
===========================================
+ Hits 224848 337875 +113027
+ Misses 146276 33395 -112881
- Partials 5992 5994 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
zyssyz123
enabled auto-merge
October 28, 2026 08:56
This was referenced Oct 28, 2026
Merged
zyssyz123
requested review from
QuantumGhost,
crazywoola and
laipz8200
as code owners
October 28, 2026 14:46
Contributor
Pyrefly Type Coverage
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-10-29 04:36:34.783750916 +0000
+++ /tmp/pyrefly_pr.txt 2026-10-29 04:36:23.727745936 +0000
@@ -5779,53 +5779,53 @@
ERROR Argument `Literal['emoji']` is not assignable to parameter `icon_type` with type `AgentIconType | SQLCoreOperations[AgentIconType | None] | None` in function `models.agent.Agent.__init__` [bad-argument-type]
--> tests/unit_tests/services/agent/test_roster_service.py:2497:19
ERROR Argument `Literal['emoji']` is not assignable to parameter `icon_type` with type `AgentIconType | SQLCoreOperations[AgentIconType | None] | None` in function `models.agent.Agent.__init__` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_roster_service.py:2652:19
+ --> tests/unit_tests/services/agent/test_roster_service.py:2653:19
ERROR Object of class `object` has no attribute `prompt` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:3064:12
+ --> tests/unit_tests/services/agent/test_roster_service.py:3073:12
ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/agent/test_roster_service.py:3255:12
+ --> tests/unit_tests/services/agent/test_roster_service.py:3264:12
ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/agent/test_roster_service.py:3256:12
+ --> tests/unit_tests/services/agent/test_roster_service.py:3265:12
ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/agent/test_roster_service.py:3257:12
+ --> tests/unit_tests/services/agent/test_roster_service.py:3266:12
ERROR Argument `list[str | None]` is not assignable to parameter `version_ids` with type `list[str]` in function `services.agent.roster_service.AgentRosterService._load_versions_by_id` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_roster_service.py:4362:52
+ --> tests/unit_tests/services/agent/test_roster_service.py:4371:52
ERROR Argument `Literal[0]` is not assignable to parameter `message_unit_price` with type `Decimal | SQLCoreOperations[Decimal]` in function `models.model.Message.__init__` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_roster_service.py:4521:36
+ --> tests/unit_tests/services/agent/test_roster_service.py:4530:36
ERROR Argument `Literal[0]` is not assignable to parameter `answer_unit_price` with type `Decimal | SQLCoreOperations[Decimal]` in function `models.model.Message.__init__` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_roster_service.py:4523:35
+ --> tests/unit_tests/services/agent/test_roster_service.py:4532:35
ERROR Argument `Literal[0]` is not assignable to parameter `total_price` with type `Decimal | SQLCoreOperations[Decimal | None] | None` in function `models.model.Message.__init__` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_roster_service.py:4524:29
+ --> tests/unit_tests/services/agent/test_roster_service.py:4533:29
ERROR Object of class `NoneType` has no attribute `conversation_id` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5297:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5306:16
ERROR Argument `Literal['simple']` is not assignable to parameter `prompt_type` with type `PromptType | SQLCoreOperations[PromptType]` in function `models.model.AppModelConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_roster_service.py:5401:25
+ --> tests/unit_tests/services/agent/test_roster_service.py:5410:25
ERROR Unpacked keyword argument `Any | None` is not assignable to parameter `prompt_type` with type `PromptType | SQLCoreOperations[PromptType]` in function `models.model.AppModelConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_roster_service.py:5409:34
+ --> tests/unit_tests/services/agent/test_roster_service.py:5418:34
ERROR Object of class `object` has no attribute `name` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5515:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5524:16
ERROR Object of class `object` has no attribute `mode` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5516:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5525:16
ERROR Object of class `object` has no attribute `agent_role` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5517:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5526:16
ERROR Object of class `object` has no attribute `config_snapshot` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5527:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5536:16
ERROR Object of class `object` has no attribute `home_snapshot_id` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5529:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5538:16
ERROR Object of class `object` has no attribute `summary` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5530:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5539:16
ERROR Object of class `object` has no attribute `version_note` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5531:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5540:16
ERROR Object of class `object` has no attribute `active_config_has_model` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5532:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5541:16
ERROR Object of class `object` has no attribute `active_config_is_published` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5533:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5542:16
ERROR Object of class `object` has no attribute `updated_by` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5534:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5543:16
ERROR Object of class `object` has no attribute `id` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5535:35
+ --> tests/unit_tests/services/agent/test_roster_service.py:5544:35
ERROR Object of class `object` has no attribute `agent_role` [missing-attribute]
- --> tests/unit_tests/services/agent/test_roster_service.py:5605:16
+ --> tests/unit_tests/services/agent/test_roster_service.py:5614:16
ERROR Argument `object` is not assignable to parameter `pwd` with type `bytes | None` in function `zipfile.ZipFile.read` [bad-argument-type]
--> tests/unit_tests/services/agent/test_skill_package_service.py:306:44
ERROR Object of class `NoneType` has no attribute `node_job_config_dict` [missing-attribute]
@@ -5989,17 +5989,17 @@
ERROR `in` is not supported between `Literal['not found']` and `None` [not-iterable]
--> tests/unit_tests/services/retention/workflow_run/test_restore_archived_workflow_run.py:894:16
ERROR Argument `SimpleNamespace` is not assignable to parameter `version` with type `AgentConfigDraft | AgentConfigSnapshot` in function `services.agent_config_service.AgentConfigTarget.__init__` [bad-argument-type]
- --> tests/unit_tests/services/test_agent_config_service.py:159:17
+ --> tests/unit_tests/services/test_agent_config_service.py:161:17
ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/test_agent_config_service.py:1023:12
+ --> tests/unit_tests/services/test_agent_config_service.py:1021:12
ERROR Type `object` is not iterable [not-iterable]
- --> tests/unit_tests/services/test_agent_config_service.py:1024:38
+ --> tests/unit_tests/services/test_agent_config_service.py:1022:38
ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/test_agent_config_service.py:1181:38
+ --> tests/unit_tests/services/test_agent_config_service.py:1179:38
ERROR Cannot index into `object` [bad-index]
- --> tests/unit_tests/services/test_agent_config_service.py:1182:12
+ --> tests/unit_tests/services/test_agent_config_service.py:1180:12
ERROR Type `object` is not iterable [not-iterable]
- --> tests/unit_tests/services/test_agent_config_service.py:1218:38
+ --> tests/unit_tests/services/test_agent_config_service.py:1216:38
ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
--> tests/unit_tests/services/test_api_token_service.py:309:13
ERROR Argument `Literal['app']` is not assignable to parameter `value` with type `ApiTokenType | SQLCoreOperations[ApiTokenType]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
|
- Compose parallel uploads and the batch bind in one dialog-root mutation; keep the pending list inside the dialog popup and show each failed file's server message. - Pass a list through `onAdded`; the Files panel inserts prompt references for every bound file when the upload dialog closes, so the prompt editor change is reverted. - Use the strict `es-toolkit` `omit` for composer saves that leave `config_files` to the server. - Return the normal Draft's files for inline workflow nodes while it is based on the bound snapshot, so loads match what the next node save persists. - Refetch the build draft before applying it in workflow nodes so a newer file list is not replaced by a cached one. - Drop the per-file status keys and restore the file type label in every locale.
- Read the current prompt when inserting slash-menu references, since file references now arrive when the upload dialog closes. - Stop applying a workflow build draft when refreshing it fails instead of saving the cached copy. - Keep an explicitly requested workflow snapshot's own files; only the bound node state shows the normal Draft's files.
lyzno1
previously approved these changes
Oct 29, 2026
lyzno1
approved these changes
Oct 29, 2026
1 task done
5 tasks
41tair
added a commit
that referenced
this pull request
Nov 6, 2026
Restore the lock-and-refresh behavior from #44947 in the extracted Agent config repository. Flush caller-owned Agent edits before refreshing the locked Agent and Draft without autoflushing stale Draft changes. The caller owns the session and transaction; successful reads retain row locks until commit or rollback. Cover stale identity-map state, pending Agent creation, owner scoping, and lock clauses with real-session regression tests.
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.
Agent configuration accepts one file at a time, and binding files can race with Composer saves that replace the full configuration snapshot. This adds multi-select and multi-file drop, uploads the files in parallel, then binds all successful upload IDs through one atomic batch request.
The new
POST config/files/batchendpoints acceptupload_file_ids, validate tenant ownership, and merge files while holding Agent and Draft row locks. Asset mutations and Composer saves use the same lock order and refresh cached Draft state after locking. Ordinary Composer saves omitconfig_files, preserving the latest server-managed files even when another tab submits a stale configuration. Explicit lists still replace the files, and[]clears them for Apply/import flows. Autosave, manual save, publish, and page-close scheduling retain their existing behavior.Per-file limits, same-name replacement, retry with cached upload IDs, and duplicate-submit/close protection remain in the upload dialog. Batch binding is all-or-nothing; individual upload failures leave other successful uploads eligible for binding. Prompt uploads preserve the original cursor and trailing text while inserting all successful references. All 25 locales and generated API contracts are updated; the existing single-file endpoint remains compatible.
Validation:
3846ebf47b: three files uploading concurrently; stale second-tab autosave preserving all files after refresh; atomic batch failure with no partial binding; retry reusing the same uploaded ID (one DB upload record before/after); two Prompt references inserted between existing text; and refresh persistence for all six files.pg_blocking_pidsand preserved the expected configuration. The dedicated test Draft and metadata were restored. Only API and Web images changed; worker, beat, and nginx retained their images and start times.Issue: https://linear.app/dify/issue/SNP-997/agent支持批量上传文件