Skip to content

fix(agent): keep replayed tool call IDs stable - #43796

Merged
Stream29 merged 1 commit into
langgenius:mainfrom
pei711:fix/43783-stable-agent-tool-call-ids
Oct 14, 2026
Merged

Stream29 merged 1 commit into
langgenius:mainfrom
pei711:fix/43783-stable-agent-tool-call-ids

Conversation

@pei711

@pei711 pei711 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Generate deterministic UUIDs for reconstructed historical tool calls from the persisted agent thought ID, tool index, and tool name.
  • Keep each assistant tool call paired with its tool response while making replayed history stable across turns for provider prompt caching.
  • Add regression coverage for stable IDs and uniqueness when a thought contains multiple tools.

Fixes #43783.

Tests

  • uv run --project api --no-sync pytest -q api/tests/unit_tests/core/agent/test_base_agent_runner.py -k 'reuses_stable_tool_call_ids or reconstructs_tool_flows' — targeted cases reported passing; pytest did not exit cleanly after tests on Windows.
  • uv run --project api --no-sync ruff check api/core/agent/base_agent_runner.py api/tests/unit_tests/core/agent/test_base_agent_runner.py — passed.
  • uv run --project api --no-sync ruff format --check api/core/agent/base_agent_runner.py api/tests/unit_tests/core/agent/test_base_agent_runner.py — passed.
  • git diff --check — passed.

@github-actions github-actions Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 10, 2026
@ghfind-review ghfind-review Bot added the review: medium ghfind author score; see https://ghfind.com label Oct 10, 2026

@Stream29 Stream29 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-10-14 06:38:25.278923252 +0000
+++ /tmp/pyrefly_pr.txt	2026-10-14 06:38:16.754836296 +0000
@@ -455,6 +455,18 @@
 ERROR Missing argument `account_id` in function `models.account.TenantAccountJoin.__init__` [missing-argument]
   --> tests/integration_tests/controllers/console/app/test_chat_message_permissions.py:53:45
 ERROR Missing argument `tenant_id` in function `models.account.TenantAccountJoin.__init__` [missing-argument]
+  --> tests/integration_tests/controllers/console/app/test_feedback_export_api.py:54:45
+ERROR Missing argument `account_id` in function `models.account.TenantAccountJoin.__init__` [missing-argument]
+  --> tests/integration_tests/controllers/console/app/test_feedback_export_api.py:54:45
+ERROR Unexpected keyword argument `id` in function `models.model.MessageFeedback.__init__` [unexpected-keyword]
+  --> tests/integration_tests/controllers/console/app/test_feedback_export_api.py:73:13
+ERROR Unexpected keyword argument `created_at` in function `models.model.MessageFeedback.__init__` [unexpected-keyword]
+  --> tests/integration_tests/controllers/console/app/test_feedback_export_api.py:82:13
+ERROR Unexpected keyword argument `id` in function `models.model.MessageFeedback.__init__` [unexpected-keyword]
+  --> tests/integration_tests/controllers/console/app/test_feedback_export_api.py:86:13
+ERROR Unexpected keyword argument `created_at` in function `models.model.MessageFeedback.__init__` [unexpected-keyword]
+  --> tests/integration_tests/controllers/console/app/test_feedback_export_api.py:95:13
+ERROR Missing argument `tenant_id` in function `models.account.TenantAccountJoin.__init__` [missing-argument]
   --> tests/integration_tests/controllers/console/app/test_model_config_permissions.py:49:45
 ERROR Missing argument `account_id` in function `models.account.TenantAccountJoin.__init__` [missing-argument]
   --> tests/integration_tests/controllers/console/app/test_model_config_permissions.py:49:45
@@ -551,8 +563,32 @@
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
    --> tests/test_containers_integration_tests/controllers/openapi/test_account_sessions.py:153:17
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_app_dsl.py:115:28
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_app_dsl.py:137:28
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_app_dsl.py:162:28
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_app_dsl.py:188:28
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_app_dsl.py:221:30
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_app_dsl.py:247:28
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_app_dsl.py:271:28
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/test_containers_integration_tests/controllers/openapi/test_app_run.py:41:22
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+  --> tests/test_containers_integration_tests/controllers/openapi/test_apps.py:63:22
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+  --> tests/test_containers_integration_tests/controllers/openapi/test_apps.py:85:22
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_apps.py:108:22
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_apps.py:127:22
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/test_containers_integration_tests/controllers/openapi/test_apps.py:151:17
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/test_containers_integration_tests/controllers/openapi/test_workspaces.py:27:22
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/test_containers_integration_tests/controllers/openapi/test_workspaces.py:50:22
@@ -753,19 +789,19 @@
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
     --> tests/test_containers_integration_tests/services/test_annotation_service.py:1050:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:180:42
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:178:42
 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/test_containers_integration_tests/services/test_app_dsl_service.py:969:25
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:967:25
 ERROR Argument `str | None` is not assignable to parameter `tenant_id` with type `str` in function `services.app_service.AppService.create_app` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1118:13
+    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1116:13
 ERROR Argument `Literal['workflow']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1258:20
+    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1256:20
 ERROR Argument `Literal['workflow']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
     --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1291:20
 ERROR Argument `Literal['workflow']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1331:20
+    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1334:20
 ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `dsl_dependencies` with type `list[PluginDependency]` in function `services.app_dsl_service.AppDslService.get_leaked_dependencies` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1606:73
+    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1617:73
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_generate_service.py:199:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -1280,20 +1316,36 @@
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:114:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:124:20
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:296:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:299:22
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:420:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:423:22
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:496:36
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:499:26
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:553:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:556:22
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:639:36
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:642:26
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:752:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:755:22
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+   --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:846:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:849:22
+ERROR Argument `IndexTechniqueType | None` is not assignable to parameter `indexing_technique` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
+    --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1000:32
 ERROR Argument `str | None` is not assignable to parameter `doc_form` with type `str` in function `celery.app.task.Task.__call__` [bad-argument-type]
     --> tests/test_containers_integration_tests/tasks/test_clean_dataset_task.py:1003:22
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -1546,14 +1598,68 @@
    --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:833:25
 ERROR Argument `dict[str, str | dict[str, dict[Unknown, Unknown] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `core.trigger.debug.event_selectors.TriggerDebugEventPoller.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/trigger/test_trigger_e2e.py:860:21
+ERROR Cannot index into `bool` [bad-index]
+  --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:58:12
+ERROR Cannot index into `float` [bad-index]
+  --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:58:12
+ERROR Cannot index into `int` [bad-index]
+  --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:58:12
+ERROR Cannot index into `list[JsonValue]` [bad-index]
+  --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:58:12
+ERROR Cannot index into `str` [bad-index]
+  --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:58:12
+ERROR `None` is not subscriptable [unsupported-operation]
+  --> tests/unit_tests/clients/agent_backend/test_event_adapter.py:58:12
+ERROR Object of class `list` has no attribute `startswith` [missing-attribute]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:180:12
+ERROR Missing argument `backend_binding_ref` in function `clients.agent_backend.request_builder.AgentBackendWorkflowNodeRunInput.__init__` [missing-argument]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:299:41
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `text` [missing-attribute]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:394:12
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `files` [missing-attribute]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:395:12
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `model_dump` [missing-attribute]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:400:37
+ERROR `not in` is not supported between `Literal['locators']` and `bytes` [unsupported-operation]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:401:12
+ERROR `not in` is not supported between `Literal['locators']` and `LayerConfig` [unsupported-operation]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:401:12
+ERROR `not in` is not supported between `Literal['locators']` and `bool` [not-iterable]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:401:12
+ERROR `not in` is not supported between `Literal['locators']` and `float` [not-iterable]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:401:12
+ERROR `not in` is not supported between `Literal['locators']` and `int` [not-iterable]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:401:12
+ERROR `not in` is not supported between `Literal['locators']` and `None` [not-iterable]
+   --> tests/unit_tests/clients/agent_backend/test_request_builder.py:401:12
 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/commands/test_archive_workflow_runs.py:181:16
 ERROR Expected a callable, got `None` [not-callable]
    --> tests/unit_tests/commands/test_archive_workflow_runs.py:350:9
+ERROR Expected a callable, got `None` [not-callable]
+  --> tests/unit_tests/commands/test_clean_expired_messages.py:33:9
+ERROR Expected a callable, got `None` [not-callable]
+  --> tests/unit_tests/commands/test_clean_expired_messages.py:63:9
+ERROR Expected a callable, got `None` [not-callable]
+  --> tests/unit_tests/commands/test_clean_expired_messages.py:94:9
+ERROR Expected a callable, got `None` [not-callable]
+   --> tests/unit_tests/commands/test_clean_expired_messages.py:176:9
 ERROR Object of class `object` has no attribute `package` [missing-attribute]
    --> tests/unit_tests/commands/test_data_migration_commands.py:170:12
 ERROR Object of class `object` has no attribute `options_override` [missing-attribute]
    --> tests/unit_tests/commands/test_data_migration_commands.py:171:12
+ERROR `(object: Unknown, /) -> None` is not assignable to attribute `echo` with type `(message: object = None, file: IO[Any] | None = None, nl: bool = True, err: bool = False, color: bool | None = None) -> None` [bad-assignment]
+   --> tests/unit_tests/commands/test_data_migration_wizard.py:147:33
+ERROR Expected a callable, got `None` [not-callable]
+  --> tests/unit_tests/commands/test_fix_app_site_missing.py:92:9
+ERROR Expected a callable, got `None` [not-callable]
+   --> tests/unit_tests/commands/test_fix_app_site_missing.py:126:9
+ERROR Expected a callable, got `None` [not-callable]
+  --> tests/unit_tests/commands/test_reset_encrypt_key_pair.py:30:9
+ERROR Object of class `NoneType` has no attribute `encrypt_public_key` [missing-attribute]
+   --> tests/unit_tests/commands/test_reset_encrypt_key_pair.py:131:12
+ERROR Object of class `NoneType` has no attribute `encrypt_public_key` [missing-attribute]
+   --> tests/unit_tests/commands/test_reset_encrypt_key_pair.py:132:12
 ERROR Object of class `ModuleType` has no attribute `upgrade` [missing-attribute]
   --> tests/unit_tests/commands/test_upgrade_db.py:15:5
 ERROR Expected a callable, got `None` [not-callable]
@@ -1704,6 +1810,22 @@
    --> tests/unit_tests/controllers/console/explore/test_message.py:279:83
 ERROR Generator function should return `Generator` [bad-return]
   --> tests/unit_tests/controllers/console/tag/test_tags.py:66:23
+ERROR Type `object` is not iterable [not-iterable]
+   --> tests/unit_tests/controllers/console/test_extension.py:179:13
+ERROR Cannot index into `object` [bad-index]
+   --> tests/unit_tests/controllers/console/test_extension.py:217:16
+ERROR Cannot index into `object` [bad-index]
+   --> tests/unit_tests/controllers/console/test_extension.py:218:16
+ERROR Cannot index into `object` [bad-index]
+   --> tests/unit_tests/controllers/console/test_extension.py:219:16
+ERROR Cannot index into `object` [bad-index]
+   --> tests/unit_tests/controllers/console/test_extension.py:251:16
+ERROR Cannot index into `object` [bad-index]
+   --> tests/unit_tests/controllers/console/test_extension.py:252:16
+ERROR Cannot index into `object` [bad-index]
+   --> tests/unit_tests/controllers/console/test_extension.py:271:16
+ERROR Type `object` is not iterable [not-iterable]
+   --> tests/unit_tests/controllers/console/test_extension.py:279:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `form` with type `Form` in function `controllers.console.human_input_form._jsonify_form_definition` [bad-argument-type]
   --> tests/unit_tests/controllers/console/test_human_input_form.py:83:41
 ERROR Argument `SimpleNamespace` is not assignable to parameter `form` with type `Form` in function `controllers.console.human_input_form.ConsoleHumanInputFormApi._ensure_console_access` [bad-argument-type]
@@ -1726,6 +1848,8 @@
    --> tests/unit_tests/controllers/console/workspace/test_endpoint.py:561:46
 ERROR Argument `Literal['team']` is not assignable to parameter `plan` with type `CloudPlan | None` in function `services.workspace.contracts.EffectiveCreditPool.__init__` [bad-argument-type]
    --> tests/unit_tests/controllers/console/workspace/test_model_providers.py:258:18
+ERROR Object of class `FunctionType` has no attribute `__apidoc__` [missing-attribute]
+   --> tests/unit_tests/controllers/inner_api/app/test_dsl.py:213:18
 ERROR Missing argument `tenant_model` in function `protected_view` [missing-argument]
    --> tests/unit_tests/controllers/inner_api/plugin/test_plugin_wraps.py:257:40
 ERROR Missing argument `user_model` in function `protected_view` [missing-argument]
@@ -1768,6 +1892,14 @@
   --> tests/unit_tests/controllers/openapi/test_account.py:36:13
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/unit_tests/controllers/openapi/test_account.py:69:18
+ERROR Argument `list[str]` is not assignable to parameter `fields` with type `set[str] | None` in function `controllers.openapi.apps.build_app_describe_response` [bad-argument-type]
+  --> tests/unit_tests/controllers/openapi/test_app_describe_builder.py:53:48
+ERROR Argument `list[str]` is not assignable to parameter `fields` with type `set[str] | None` in function `controllers.openapi.apps.build_app_describe_response` [bad-argument-type]
+  --> tests/unit_tests/controllers/openapi/test_app_describe_builder.py:63:48
+ERROR Argument `list[str]` is not assignable to parameter `fields` with type `set[str] | None` in function `controllers.openapi.apps.build_app_describe_response` [bad-argument-type]
+  --> tests/unit_tests/controllers/openapi/test_app_describe_builder.py:76:48
+ERROR Argument `list[str]` is not assignable to parameter `fields` with type `set[str] | None` in function `controllers.openapi.apps.build_app_describe_response` [bad-argument-type]
+  --> tests/unit_tests/controllers/openapi/test_app_describe_builder.py:86:48
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:87:18
 ERROR Object of class `Resource` has no attribute `post` [missing-attribute]
@@ -1780,6 +1912,8 @@
    --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:210:20
 ERROR Object of class `Resource` has no attribute `post` [missing-attribute]
    --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:228:20
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+  --> tests/unit_tests/controllers/openapi/test_apps_permitted_external_query.py:71:18
 ERROR Object of class `FunctionType` has no attribute `view_class` [missing-attribute]
   --> tests/unit_tests/controllers/openapi/test_device_approve_deny.py:41:12
 ERROR Object of class `FunctionType` has no attribute `view_class` [missing-attribute]
@@ -1788,6 +1922,16 @@
   --> tests/unit_tests/controllers/openapi/test_device_approve_deny.py:52:12
 ERROR `in` is not supported between `Literal['POST']` and `None` [not-iterable]
   --> tests/unit_tests/controllers/openapi/test_device_approve_deny.py:53:12
+ERROR Object of class `FunctionType` has no attribute `view_class` [missing-attribute]
+  --> tests/unit_tests/controllers/openapi/test_device_code.py:36:12
+ERROR `in` is not supported between `Literal['POST']` and `None` [not-iterable]
+  --> tests/unit_tests/controllers/openapi/test_device_code.py:41:12
+ERROR Object of class `FunctionType` has no attribute `view_class` [missing-attribute]
+  --> tests/unit_tests/controllers/openapi/test_device_lookup.py:31:12
+ERROR `in` is not supported between `Literal['GET']` and `None` [not-iterable]
+  --> tests/unit_tests/controllers/openapi/test_device_lookup.py:36:12
+ERROR Object of class `FunctionType` has no attribute `view_class` [missing-attribute]
+  --> tests/unit_tests/controllers/openapi/test_device_token.py:31:12
 ERROR Object of class `UnprocessableEntity` has no attribute `data` [missing-attribute]
   --> tests/unit_tests/controllers/openapi/test_error_contract.py:99:9
 ERROR Object of class `UnprocessableEntity` has no attribute `data` [missing-attribute]
@@ -1953,7 +2097,7 @@
 ERROR `_RequestStub` is not assignable to attribute `request` with type `Request` [bad-assignment]
   --> tests/unit_tests/controllers/trigger/test_webhook.py:31:22
 ERROR Object of class `Exception` has no attribute `data` [missing-attribute]
-   --> tests/unit_tests/controllers/web/test_app.py:250:16
+   --> tests/unit_tests/controllers/web/test_app.py:192:16
 ERROR Object of class `ModuleType` has no attribute `web_ns` [missing-attribute]
   --> tests/unit_tests/controllers/web/test_message_list.py:57:9
 ERROR Object of class `ModuleType` has no attribute `WebApiResource` [missing-attribute]
@@ -1997,49 +2141,49 @@
 ERROR Expected 1 more positional argument [bad-argument-count]
   --> tests/unit_tests/controllers/web/test_wraps.py:51:23
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:56:71
+  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:68:71
 ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
-  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:57:23
+  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:69:23
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:61:71
+  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:73:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:66:71
+  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:78:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:75:71
+  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:84:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:81:62
+  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:90:62
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:91:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:100:62
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-  --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:97:71
-ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:105:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:106:62
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
    --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:112:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:121:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:119:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:126:71
-ERROR `in` is not supported between `Literal['{"foo": "bar"']` and `AgentScratchpadUnit.Action` [unsupported-operation]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:128:20
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:128:62
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:139:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:133:71
+ERROR `in` is not supported between `Literal['{"foo": "bar"']` and `AgentScratchpadUnit.Action` [unsupported-operation]
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:135:20
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:152:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:146:62
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:162:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:157:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
    --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:167:71
+ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:172:71
 ERROR `in` is not supported between `Literal['```json {"a":1}']` and `AgentScratchpadUnit.Action` [unsupported-operation]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:169:20
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:174:20
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:186:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:191:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:195:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:200:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:205:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:210:71
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
-   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:218:71
+   --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:221:62
 ERROR Argument `list[Unknown]` is not assignable to parameter `llm_response` with type `Generator[LLMResultChunk]` in function `core.agent.output_parser.cot_output_parser.CotAgentOutputParser.handle_react_stream_output` [bad-argument-type]
    --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:226:71
 ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
@@ -2048,6 +2192,12 @@
    --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:247:71
 ERROR No matching overload found for function `str.join` called with arguments: (list[AgentScratchpadUnit.Action | str]) [no-matching-overload]
    --> tests/unit_tests/core/agent/output_parser/test_cot_output_parser.py:249:25
+ERROR Cannot instantiate `BaseAgentStrategy` because the following members are abstract: `_invoke` [bad-instantiation]
+  --> tests/unit_tests/core/agent/strategy/test_base.py:46:30
+ERROR Argument `None` is not assignable to parameter `user_id` with type `str` in function `core.agent.strategy.base.BaseAgentStrategy.invoke` [bad-argument-type]
+   --> tests/unit_tests/core/agent/strategy/test_base.py:154:58
+ERROR Argument `None` is not assignable to parameter `params` with type `dict[str, Any]` in function `core.agent.strategy.plugin.PluginAgentStrategy.initialize_parameters` [bad-argument-type]
+   --> tests/unit_tests/core/agent/strategy/test_plugin.py:138:44
 ERROR `None` is not assignable to attribute `agent_callback` with type `DifyAgentCallbackHandler` [bad-assignment]
    --> tests/unit_tests/core/agent/test_cot_agent_runner.py:120:29
 ERROR Object of class `DummyRunner` has no attribute `session` [missing-attribute]
@@ -2232,6 +2382,10 @@
    --> tests/unit_tests/core/agent/test_fc_agent_runner.py:639:29
 ERROR Missing argument `description` in function `core.agent.plugin_entities.AgentStrategyEntity.__init__` [missing-argument]
    --> tests/unit_tests/core/agent/test_plugin_entities.py:292:32
+ERROR Invalid key for TypedDict `AppParametersDict`, got `Unknown` [bad-typed-dict-key]
+  --> tests/unit_tests/core/app/app_config/common/test_parameters_mapping.py:67:23
+ERROR Invalid key for TypedDict `AppParametersDict`, got `str` [bad-typed-dict-key]
+   --> tests/unit_tests/core/app/app_config/common/test_parameters_mapping.py:130:27
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.agent.manager.AgentConfigManager.convert` [bad-argument-type]
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_agent_manager.py:28:45
 ERROR Object of class `NoneType` has no attribute `strategy` [missing-attribute]
@@ -2254,38 +2408,42 @@
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:59:47
 ERROR Argument `dict[str, str | dict[str, str | dict[str, list[dict[str, dict[str, bool | Unknown]]] | str]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:74:47
-ERROR Argument `dict[str, str | dict[str, str | dict[str, list[Unknown] | str] | dict[str, str] | dict[str, list[dict[str, dict[str, bool | Unknown]]] | str]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:93:47
-ERROR Argument `dict[str, dict[str, str | dict[str, list[dict[str, dict[str, bool | Unknown]]] | str]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
+ERROR Argument `dict[str, str | dict[str, str | dict[str, str] | dict[str, list[dict[str, dict[str, bool | Unknown]]] | str]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
    --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:115:47
-ERROR Object of class `NoneType` has no attribute `retrieve_config` [missing-attribute]
+ERROR Object of class `NoneType` has no attribute `dataset_ids` [missing-attribute]
    --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:116:16
 ERROR Object of class `NoneType` has no attribute `retrieve_config` [missing-attribute]
    --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:117:16
+ERROR Argument `dict[str, dict[str, str | dict[str, list[dict[str, dict[str, bool | Unknown]]] | str]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:129:47
+ERROR Object of class `NoneType` has no attribute `retrieve_config` [missing-attribute]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:130:16
+ERROR Object of class `NoneType` has no attribute `retrieve_config` [missing-attribute]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:131:16
 ERROR Object of class `NoneType` has no attribute `retrieve_config` [missing-attribute]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:118:16
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:132:16
 ERROR Argument `dict[str, dict[str, bool | list[dict[str, dict[str, bool | Unknown]]]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:127:47
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:141:47
 ERROR Argument `dict[str, DatasetConfigs | None]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:133:42
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:147:42
 ERROR Argument `dict[str, dict[str, bool | list[dict[str, dict[str, bool | Unknown]]]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:142:47
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:156:47
 ERROR Object of class `NoneType` has no attribute `dataset_ids` [missing-attribute]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:143:16
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:157:16
 ERROR Object of class `NoneType` has no attribute `retrieve_config` [missing-attribute]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:144:16
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:158:16
 ERROR Argument `dict[str, str | dict[str, bool | float | int | str | dict[str, list[dict[str, dict[str, bool | Unknown]]] | str]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:161:47
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:175:47
 ERROR Object of class `NoneType` has no attribute `retrieve_config` [missing-attribute]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:162:16
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:176:16
 ERROR Object of class `NoneType` has no attribute `retrieve_config` [missing-attribute]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:163:16
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:177:16
 ERROR Argument `dict[str, dict[str, str | dict[str, list[Unknown] | str]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:181:47
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:195:47
 ERROR Argument `dict[str, dict[str, bool | list[dict[str, dict[str, bool | Unknown]]]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.dataset.manager.DatasetConfigManager.convert` [bad-argument-type]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:191:47
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:205:47
 ERROR Object of class `NoneType` has no attribute `dataset_ids` [missing-attribute]
-   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:192:16
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_dataset_manager.py:206:16
 ERROR Missing required key `opening_statement` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
    --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_model_config_manager.py:112:40
 ERROR Missing required key `suggested_questions` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
@@ -2329,53 +2487,71 @@
 ERROR Argument `dict[str, dict[str, str | dict[str, float]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.model_config.manager.ModelConfigManager.convert` [bad-argument-type]
    --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_model_config_manager.py:122:45
 ERROR Missing required key `opening_statement` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `suggested_questions` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `suggested_questions_after_answer` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `speech_to_text` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `text_to_speech` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `retriever_resource` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `annotation_reply` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `more_like_this` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `sensitive_word_avoidance` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `external_data_tools` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `model` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `user_input_form` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `dataset_query_variable` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `pre_prompt` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `agent_mode` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `prompt_type` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `chat_prompt_config` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `completion_prompt_config` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `dataset_configs` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Missing required key `file_upload` for TypedDict `AppModelConfigDict` [bad-typed-dict-key]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:14:49
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:45:49
 ERROR Argument `dict[str, str]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.convert` [bad-argument-type]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:19:54
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:60:54
 ERROR Argument `dict[str, str | dict[str, list[dict[str, str]]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.convert` [bad-argument-type]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:31:54
+  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:95:54
 ERROR Argument `dict[str, str | dict[str, list[Unknown]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.convert` [bad-argument-type]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:54:49
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:121:49
 ERROR Argument `dict[str, str | dict[str, dict[str, str]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.convert` [bad-argument-type]
-  --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:68:54
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:149:54
+ERROR Argument `Literal['chat_app']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.validate_and_set_defaults` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:177:78
+ERROR Class member `InvalidEnum.__iter__` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:184:17
+ERROR Argument `Literal['chat_app']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.validate_and_set_defaults` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:198:67
+ERROR Argument `Literal['chat_app']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.validate_and_set_defaults` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:210:67
+ERROR Argument `Literal['chat_app']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.validate_and_set_defaults` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:222:67
+ERROR Argument `Literal['chat_app']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.validate_and_set_defaults` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:235:67
+ERROR Argument `Literal['chat_app']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.validate_and_set_defaults` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:247:67
+ERROR Argument `Literal['chat_app']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.validate_and_set_defaults` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:259:67
+ERROR Argument `Literal['chat']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.easy_ui_based_app.prompt_template.manager.PromptTemplateConfigManager.validate_and_set_defaults` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_prompt_template_manager.py:276:76
 ERROR Argument `dict[Unknown, Unknown]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_variables_manager.py:14:67
 ERROR Argument `dict[str, list[dict[str, bool | str | dict[str, str]] | dict[str, bool]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
@@ -2384,6 +2560,26 @@
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_variables_manager.py:68:67
 ERROR Argument `dict[str, list[dict[VariableEntityType, dict[str, str]]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
   --> tests/unit_tests/core/app/app_config/easy_ui_based_app/test_variables_manager.py:85:67
+ERROR Argument `Literal['CHAT']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.base_app_config_manager.BaseAppConfigManager.convert_features` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/test_base_app_config_manager.py:125:70
+ERROR Argument `Literal['CHAT']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.base_app_config_manager.BaseAppConfigManager.convert_features` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/test_base_app_config_manager.py:145:67
+ERROR Argument `Literal['CHAT']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.base_app_config_manager.BaseAppConfigManager.convert_features` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/test_base_app_config_manager.py:156:69
+ERROR Argument `Literal['CHAT']` is not assignable to parameter `app_mode` with type `AppMode` in function `core.app.app_config.base_app_config_manager.BaseAppConfigManager.convert_features` [bad-argument-type]
+   --> tests/unit_tests/core/app/app_config/test_base_app_config_manager.py:178:71
+ERROR Cannot index into `VariableEntity` [bad-index]
+   --> tests/unit_tests/core/app/app_config/workflow_ui_based_app/test_workflow_ui_based_app_manager.py:119:16
+ERROR Cannot index into `VariableEntity` [bad-index]
+   --> tests/unit_tests/core/app/app_config/workflow_ui_based_app/test_workflow_ui_based_app_manager.py:140:16
+ERROR Cannot index into `VariableEntity` [bad-index]
+   --> tests/unit_tests/core/app/app_config/workflow_ui_based_app/test_workflow_ui_based_app_manager.py:159:16
+ERROR Cannot index into `VariableEntity` [bad-index]
+   --> tests/unit_tests/core/app/app_config/workflow_ui_based_app/test_workflow_ui_based_app_manager.py:178:16
+ERROR Cannot index into `RagPipelineVariableEntity` [bad-index]
+   --> tests/unit_tests/core/app/app_config/workflow_ui_based_app/test_workflow_ui_based_app_manager.py:246:16
+ERROR Cannot index into `RagPipelineVariableEntity` [bad-index]
+   --> tests/unit_tests/core/app/app_config/workflow_ui_based_app/test_workflow_ui_based_app_manager.py:273:16
 ERROR Expected a mapping, got object | None [invalid-argument]
   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_config_manager.py:41:29
 ERROR Argument `SimpleNamespace` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.single_loop_generate` [bad-argument-type]
@@ -2585,13 +2781,7 @@
 ERROR `(**kwargs: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent | str) -> Literal['failed']` is not assignable to attribute `workflow_node_finish_to_stream_response` with type `(*, event: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent, task_id: str) -> NodeFinishStreamResponse | None` [bad-assignment]
    --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:724:89
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:412:38
-ERROR Class `FakeAgentBackendScenario` has no class attribute `PAUSED` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:198:35
-ERROR Argument `tuple[AgentAppSessionScope, str, SessionSnapshot | None]` is not assignable to parameter `object` with type `tuple[AgentAppSessionScope, str, SessionSnapshot | None, str | None, str | None]` in function `list.append` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:568:27
-ERROR Cannot unpack tuple[AgentAppSessionScope, str, SessionSnapshot | None, str | None, str | None] (of size 5) into 3 values [bad-unpacking]
-   --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:745:5
+   --> tests/unit_tests/core/app/apps/agent_app/test_app_generator.py:415:38
 ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
   --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:77:12
 ERROR Object of class `NoneType` has no attribute `prompt_messages` [missing-attribute]
@@ -2614,50 +2804,94 @@
    --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:160:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:164:16
-ERROR Object of class `list` has no attribute `startswith` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:461:16
-ERROR Object of class `NoneType` has no attribute `kind` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:482:16
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `plugin_id` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:272:16
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `model_provider` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:273:16
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `context_window_tokens` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:274:16
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `conversation_id` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:278:16
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `user_from` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:280:16
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `invoke_from` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:281:16
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `agent_mode` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:282:16
+ERROR Object of type `LayerConfig | Mapping[str, object] | bool | bytes | dict[str, JsonValue] | float | int | list[JsonValue] | str | None` has no attribute `prefix` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:476:16
+ERROR Object of class `object` has no attribute `startswith` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/agent_app/test_runtime_request_builder.py:477:16
+ERROR `in` is not supported between `Literal['```text\nYou are Iris.\n\n... (truncated) ...

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 74.39% 71.40% -2.98%
Strict coverage 74.05% 71.06% -2.99%
Typed symbols 60,465 57,331 -3,134
Untyped symbols 20,914 23,073 +2,159
Modules 3753 3722 -31

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.71%. Comparing base (b350b7a) to head (e33a361).
⚠️ Report is 171 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #43796      +/-   ##
==========================================
- Coverage   88.71%   88.71%   -0.01%     
==========================================
  Files        5208     5208              
  Lines      327187   327187              
  Branches    65525    65525              
==========================================
- Hits       290268   290263       -5     
- Misses      31677    31682       +5     
  Partials     5242     5242              
Flag Coverage Δ
api 88.42% <100.00%> (-0.01%) ⬇️

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:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Stream29
Stream29 added this pull request to the merge queue Oct 14, 2026
Merged via the queue into langgenius:main with commit fcd2f4e Oct 14, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: medium ghfind author score; see https://ghfind.com size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent history replay assigns a new random tool_call_id to past tool calls every turn, defeating prompt caching

2 participants