Skip to content

fix(agent): align config detail and output contracts#37535

Merged
zyssyz123 merged 8 commits into
mainfrom
fix/agent-config-contract-linear
Jun 17, 2026
Merged

fix(agent): align config detail and output contracts#37535
zyssyz123 merged 8 commits into
mainfrom
fix/agent-config-contract-linear

Conversation

@zyssyz123

Copy link
Copy Markdown
Contributor

Summary

  • Add active_config_is_published to Agent app list/detail and roster responses so the UI can tell whether the current active Agent config has been published.
  • Add explicit value support for Agent secret refs and map it to the Agent backend shell-layer ref at runtime.
  • Add nested declared output support for Workflow Agent nodes, including object children and array item children in composer/draft graph and runtime JSON Schema.

    Linear

    • DIFY-2493
    • DIFY-2488
    • DIFY-2486

    Validation

    • uv run ruff check api/models/agent_config_entities.py api/core/workflow/nodes/agent_v2/runtime_request_builder.py api/services/agent/roster_service.py api/controllers/console/agent/roster.py api/controllers/console/app/app.py api/fields/agent_fields.py api/tests/unit_tests/core/workflow/nodes/agent_v2/test_runtime_request_builder.py api/tests/unit_tests/services/agent/test_agent_services.py
    • uv run --project api python -m py_compile ...targeted files...
    • Deployed first to deploy/agent at 186f5a8274 and verified on https://agent.dify.dev:
      • GET /console/api/agent and GET /console/api/agent/{agent_id} return active_config_is_published.
      • PUT/GET /console/api/agent/{agent_id}/composer persists and returns env.secret_refs[].value.
      • Runtime shell layer maps value to Agent backend secret_refs[].ref.
      • PUT/GET /console/api/apps/{app_id}/workflows/draft/nodes/{node_id}/agent-composer preserves nested declared output children.
      • GET /console/api/apps/{app_id}/workflows/draft projects nested agent_declared_outputs into graph node data.

    Note: local pytest still exits with 139 before targeted tests run in this workspace, matching the previous local environment behavior.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 48.59% 48.60% +0.01%
Strict coverage 48.10% 48.11% +0.01%
Typed symbols 27,995 28,005 +10
Untyped symbols 29,922 29,924 +2
Modules 2892 2892 0

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-06-16 18:09:23.822589349 +0000
+++ /tmp/pyrefly_pr.txt	2026-06-16 18:09:15.800528915 +0000
@@ -1865,31 +1865,31 @@
 ERROR No attribute `MethodView` in module `builtins` [missing-attribute]
  --> tests/unit_tests/controllers/common/test_fields.py:9:5
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:575:74
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:583:74
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:575:98
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:583:98
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:625:30
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:633:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:626:27
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:634:27
 ERROR Object of class `object` has no attribute `data` [missing-attribute]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:706:50
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:714:50
 ERROR Object of class `object` has no attribute `limit` [missing-attribute]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:707:30
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:715:30
 ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:708:33
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:716:33
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:720:67
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:728:67
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:736:30
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:744:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:737:27
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:745:27
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:773:26
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:781:26
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:774:23
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:782:23
 ERROR Argument `Literal['00000000-0000-0000-0000-000000000002']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:775:24
+   --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:783:24
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
    --> tests/unit_tests/controllers/console/app/test_annotation_security.py:221:38
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
@@ -6067,33 +6067,33 @@
 ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `recipients` with type `Sequence[HumanInputFormRecipient]` in function `repositories.sqlalchemy_api_workflow_run_repository._build_human_input_required_reason` [bad-argument-type]
   --> tests/unit_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:56:9
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.project_draft_bindings_to_graph` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1273:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:1331:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1329:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:1390:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1398:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:1459:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1453:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:1514:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1485:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:1546:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1517:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:1578:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1563:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:1624:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1623:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:1684:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1693:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:1754:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1726:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:1787:21
 ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1938:37
+    --> tests/unit_tests/services/agent/test_agent_services.py:1999:37
 ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1975:34
+    --> tests/unit_tests/services/agent/test_agent_services.py:2036:34
 ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1999:34
+    --> tests/unit_tests/services/agent/test_agent_services.py:2060:34
 ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
-    --> tests/unit_tests/services/agent/test_agent_services.py:2000:12
+    --> tests/unit_tests/services/agent/test_agent_services.py:2061:12
 ERROR Object of class `NoneType` has no attribute `workflow_prompt` [missing-attribute]
    --> tests/unit_tests/services/agent/test_composer_mention_validation.py:113:5
 ERROR Class member `ConcreteApiKeyAuth.validate_credentials` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]

@autofix-ci autofix-ci Bot requested a review from crazywoola as a code owner June 16, 2026 16:36
@github-actions github-actions Bot added the web This relates to changes on the web. label Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.40230% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.29%. Comparing base (56dce93) to head (b0e6b70).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/services/agent/roster_service.py 87.50% 2 Missing ⚠️
...workflow/nodes/agent_v2/runtime_request_builder.py 95.83% 0 Missing and 1 partial ⚠️
api/models/agent_config_entities.py 97.29% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #37535   +/-   ##
=======================================
  Coverage   86.29%   86.29%           
=======================================
  Files        4777     4777           
  Lines      240794   240874   +80     
  Branches    44459    44476   +17     
=======================================
+ Hits       207788   207874   +86     
+ Misses      28959    28955    -4     
+ Partials     4047     4045    -2     
Flag Coverage Δ
api 86.00% <95.40%> (+0.01%) ⬆️
dify-ui 94.94% <ø> (ø)
web 86.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zyssyz123 zyssyz123 enabled auto-merge June 17, 2026 00:53
@zyssyz123 zyssyz123 added this pull request to the merge queue Jun 17, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 17, 2026
Merged via the queue into main with commit bacc48d Jun 17, 2026
42 checks passed
@zyssyz123 zyssyz123 deleted the fix/agent-config-contract-linear branch June 17, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants