Skip to content

feat(api): implement BYOA external agent backend (DIFY-3025) - #45918

Open
zyssyz123 wants to merge 66 commits into
mainfrom
codex/dify-3025-byoa-backend-20261109
Open

zyssyz123 wants to merge 66 commits into
mainfrom
codex/dify-3025-byoa-backend-20261109

Conversation

@zyssyz123

@zyssyz123 zyssyz123 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Adds the workspace External Agent backend and Workflow execution support for BYOA, using the frozen product contract.

Behavior

  • Verify failures preserve the four existing reason categories and expose optional evidence-backed subreasons and bounded, schema-owned Card validation paths. Initial Card discovery is distinguished from protected Card reads; runtime error/retry behavior and SSRF/TLS/redirect policy remain unchanged.
  • Native and External Agents share the workspace Agent tag pool on canonical Agent IDs. External tag bindings require a valid live roster identity and saved Head, serialize with archival, and leave connection/context/test revisions unchanged.
  • Verify connections without submitting business tasks. Store immutable Agent Card/connection revisions, masked credentials, saver audit, workspace permissions, status counts, sorting and application references.
  • Run A2A 1.0 HTTP+JSON tasks/messages with SSE and known-task polling. Preserve conversation/node binding context, enforce bounded waits and explicit cancellation/retry rules, and avoid resubmitting unknown remote outcomes.
  • Resolve referenced task inputs and the finite file profile, import output files, validate declared outputs and apply node error handling. Test files use scoped leases and refreshable signed URLs.
  • Persist owner-scoped invocation/Trace history, usage provenance and logical retry totals. Reported zero remains zero; unreported usage remains null. Single-step Last Run includes resolved Input and safe persisted Total Tokens.
  • Export canonical traces through the existing provider SDK catalog. Root I/O requires both source App and destination authorization; child input uses only reported parameters/requests, and unreported child output stays absent. Redact credentials and file capabilities before bounded projection.
  • Show App content authorization independently of its own tracing provider. Last Run reads frozen target policy and actual prepared-content status, with explicit restriction reasons and a separate delivery result. Current settings never rewrite an earlier invocation's explanation.

API and schema

  • Verify errors remain HTTP 400 / verification_failed. Optional details.subreason and details.card_errors use forward-compatible string fields, with only safe internal values emitted. Card paths omit peer values, validator messages, dynamic map keys and credential-bearing data.
  • External asset responses include current tags and effective Agent permission_keys. Repeated UUID tag_ids use AND semantics before visibility-scoped counts and pagination, together with existing search/creator/status filters. Labels and ACLs are projected in batches. Existing shared tag APIs from #46571 now admit External targets; archival clears only the target's Agent tag bindings in the same transaction. No tag migration is added.
  • Official OpenAPI Markdown and generated TypeScript/Zod/Console clients are updated.
  • Adds the App/run-scoped read-only trace-capture endpoint with tenant, test/run permission and retention checks; it does not load retained bodies or provider credentials.
  • Defines the final BYOA schema in one linear migration, c3025byoa1124, after main head f8b6e2c4a901: 17 tables, 18 indexes and 3 Native binding columns, including the portable rolling-writer JSON default and nullable capture policy. Existing development-only merge/default/capture revisions are consolidated before release; upstream migration history is unchanged. No historical authorization, content, delivery or task is backfilled/replayed.
  • Includes the DIFY-3047, DIFY-3051, DIFY-3054, DIFY-3055, DIFY-3056, DIFY-3057, DIFY-3058 and DIFY-3064 follow-up fixes in this same PR.
  • Application references include live App icon type, value, background and refreshable image URL. Existing App visibility and node deduplication are preserved; tenant-owned image uploads are admitted in one batch after visibility filtering.

DIFY-3054 connection-conflict recovery is fixed on the existing frontend branch, and deployed incrementally to dev. Verify and Save retain the existing HTTP 409 + GET detail contract documented in this PR; no new backend response or credential read is introduced. Both explicit recovery actions clear obsolete verification and replacement credentials, preserve non-credential edits, and use the selected latest revision before any new save.

DIFY-3058 actual AppIcon rendering is synchronized on the existing frontend branch, together with the officially generated nullable icon fields. No additional PR or dev history is added to this backend PR.

DIFY-3057 roster and Workflow tag UI is synchronized on the existing frontend branch: shared management, per-resource tag editing, AND filters across all three picker sources, repeated-query serialization and cross-kind cache refresh. External connection/control-plane permissions remain separate. RBAC-enabled tag management requires the companion rbac#149; the dev acceptance environment has RBAC disabled.

Validation

  • DIFY-3064: 358 focused backend regressions and strict typing/lint pass, including normal-main merge conflict owners. The exact dev source passes 85 Linux cases with the original image dependency fingerprints, no networking beyond injected loopback and no shared database. Official generated schemas accept old reason-only errors and unknown future refinement strings while retaining the four known reason alternatives.

  • Connect/Edit field feedback, conservative fallback, current-auth conditions, safe Card paths, same-input button/Enter retry and existing 409/unknown-save behavior pass 56 dev browser cases and 55 frontend-branch cases. The final session/focus integration, Overview and Manage menu callers pass 93 related browser cases; all 338 Agent V2 files pass static checks and a reverse-import audit covers 53 bindings; existing Native tag dialog behavior and unrelated dev changes are preserved. The new Chinese/English/Japanese text matches the linked frontend error specification; all 25 locales include the new keys.

  • Migration consolidation: 9 focused SQLite/DDL/offline regressions pass, including Native data and old-writer compatibility, full final schema, downgrade and re-upgrade. Fresh isolated PostgreSQL 15 and MySQL 8 execute the actual old three-step and new single-step Alembic operations from the same Native binding precondition; final schema, constraints, indexes, defaults and synthetic data match. Both engines pass downgrade/re-upgrade, omitted-column old-writer inserts and SQL-NULL capture-policy checks. This validates the feature delta, not a full-main fresh installation. The public graph has one new revision and one head; all 253 upstream migration files remain byte-identical. Shared dev keeps its already-applied private lineage and version table unchanged; the reviewed adoption notes prohibit copying the cleaned migration tree or automatically stamping an existing database.

  • Latest-main CI compatibility: migrate the three existing capture/consent browser specs to the new contract Fake API boundary; all 9 expanded privacy/authorization/history cases, changed-file checks and browser policy pass. The archive repository fixture now creates the existing Tag/TagBinding tables; the original CI failure is reproduced before the fix and 38 related cases pass after it. These follow-ups change only four test files.

  • DIFY-3057: 321 focused backend and 57 contract tests pass, with Ruff, Pyrefly, response/import boundaries and official generated-contract drift checks. The latest-main merge preserves the validated API/dify-agent/contracts trees exactly. Linux validates 164 targeted cases, 130 Native plus 114 External real HTTP checks using fresh PostgreSQL/Redis and normal login/CSRF, and 16 PostgreSQL concurrency checks. Enabled-RBAC grant/revoke/creator cases use explicitly stubbed policy ports; they are not described as live RBAC service E2E.

  • Real dev UI acceptance passes shared tag creation, binding to Native and disabled External assets, shared counts, AND/search/status filtering, rename refresh across both kinds, target-only unbinding, all Workflow picker sources and deleted-filter bookmark cleanup. Synthetic tags were deleted and the Native draft was archived; Studio quota stays 5/5. Original graph semantics, variables, Last Run and External connection/test state are preserved. Opening the existing Workflow editor performs its ordinary no-content autosave timestamp update.

  • Frontend focused suites and static checks pass on the dev and frontend-only candidates, including after merging concurrent connection recovery/loading changes. The reused local dependency environment cannot pass the full repository check because unrelated CLI/E2E packages are not installed; changed-file checks and the official dev build pass.

  • DIFY-3058: 192 focused backend cases, 57 contract cases, 34 related browser cases, and final generated-contract/static checks pass. Current App icon updates and refreshed signatures are covered by real SQL and HTTP regressions, including fixed query count, hidden Apps, foreign/temporary/missing files, and nullable metadata. Real dev browser acceptance verifies custom emoji/background, an uploaded PNG, full-page reload with a new signed URL, and image-to-emoji updates. Anonymous origin downloads match the uploaded PNG bytes; public non-browser downloads were blocked by the existing Cloudflare policy, while the public browser image decoded successfully.

  • DIFY-3054 follow-up: 16 browser cases and static checks pass on the dev and frontend-only candidates. Real dev two-tab acceptance passed Verify 409 with Use latest, Verify 409 with Keep edits + fresh Verify + explicit Save, and Save 409 without overwriting the other editor. Latest saver/time match immutable revisions. Twelve existing backend conflict/audit regressions and 264 service/DSL/Workflow/BYOA merge regressions pass.

  • Existing BYOA backend, usage, Last Run and provider-wire regressions are covered by the focused suites and Linux validation recorded with the implementation.

  • The App capture follow-up passes 338 targeted backend tests plus the migration-head check, real SQL policy/read-permission cases, portable migration tests, 9 focused browser cases, affected component tests, all 25 locale contracts and merged-main static checks.

  • Three independently preserved Linux runtime candidates passed exact source/dependency checks and synthetic capture/redaction/access/SDK vectors.

  • Real dev frontend + Langfuse Cloud acceptance passed for three App-context single-step runs: source off/target on and source on/target off export metadata only with the exact restriction reason; both on exports the full resolved Task and validated result. Child zero/false parameters survive, and unreported child output remains absent. The App's own provider stays disabled/unconfigured throughout. All three tasks and first-attempt deliveries succeeded; changing both current gates and refreshing preserves the original policy, status, reasons and payload hashes without another task or export.

Refs backend design, frontend integration guide, DIFY-3025 DIFY-3056, DIFY-3057 and DIFY-3058.

DIFY-3064 follows the frontend error contract and issue. The Avatar test fixture is updated to pass the existing required scoped file-access port introduced by this PR; 23 related regressions and strict test typing pass, with no production fallback.

The latest-main knowledge summary retry regression now binds its fake clock only to the summary adapter, leaving global time.sleep and unrelated analytics workers intact. The original isolation failure is reproduced deterministically; all 110 adapter regressions and strict typing/lint pass with the original transaction, backoff and persistence assertions preserved. This changes only the test fixture.

The complete PR CI at 71df55bfef finishes with 74 successful checks and 5 skipped checks, including both Linux API unit shards, controller/integration suites, generated contracts, Python guards/style, Web suites, CodeQL and coverage reports.

DIFY-3064 final live acceptance uses deploy/agent at 7f36a366, which retains the concurrent DIFY-3060 merge and all BYOA verification changes. Its official immutable API image and exact new dependency fingerprints pass the 85-case Linux suite; all 9 runtime roles report that revision with zero restarts. After a full page reload, the real Connect UI shows the invalid-A2A endpoint field error, supports unchanged-input button and Enter retries, and shows network-unreachable feedback below the form without blaming the endpoint. Cancel returns to an empty roster. Workspace configuration, private migration lineage, worker/Beat settings and owned QA records are preserved; concurrent additions are retained.

The field feedback and management-session regression tests are synchronized in the existing frontend branch; no separate frontend PR is created. Final official build and deployment both pass.

Default workflow edge compatibility

A newly created branching Agent could finish its external task successfully while its Output node was skipped: the editor supplied an empty default sourceHandle, whereas the engine selected source. Normalize only that empty alias at Dify's graph execution boundary. Named condition/failure handles, strict invalid/null rejection, and the caller's input remain unchanged; no graph or schema migration is added.

This was found during real endpoint-documentation acceptance for dify-docs#1277. The unchanged published text adapter passed public HTTPS, Console Verify, and Overview Run test. After incremental dev deployment of 824258b434, a fresh workflow was constructed and run without refreshing the editor. Its stored draft and raw run snapshot still contained empty handles, and User Input → External Agent → Output all completed with the expected aggregate text. Last Run also showed the resolved task and returned answer.

Validation includes 99 focused tests on the original immutable dev Linux image and exact Graphon/dependency fingerprints, plus 1,706 focused checks after normally merging public main e4fe2e35. Official generators produce no further drift; all upstream migration files remain unchanged. Dev retains its private migration lineage and existing configuration, queues, Beat, applications, and independent endpoint. The public-main merge is confined to this PR branch and is not applied to dev.

The merge also migrates the capture-row query's removed context.silent flag to meta.errorToast: false, retaining inline error feedback. The exact TS2353 check reproduces before the change and passes after it; 25 query-policy cases pass. No dependency or lockfile changes are made by that follow-up.

External reply field diagnostics (DIFY-3068)

A Test agent run could receive message.role: ROLE_AGENT without message.contextId, yet show the combined error “Server Message context and role are required.” The result now identifies the confirmed missing or invalid reply field and directs the user to the external Agent maintainer. The role guidance explicitly distinguishes the A2A reply's message.role from the editable Dify Agent information Role.

  • Preserve existing runtime error codes, unknown-submission handling, context admission and retry policy. Do not fabricate a context or resubmit the task. Add an optional, fixed metadata.response_issue projection with source: external_agent_reply and a whitelisted code for missing/invalid context, missing/invalid role, or both.
  • Refine only a strictly decoded, unambiguous initial direct Message, including an initial SSE Message. Transport/authentication failures, malformed JSON, ambiguous envelopes and later errors after a known receipt retain their existing behavior. Diagnostics never include peer values, Pydantic error prose, credentials or arbitrary paths.
  • Persist the optional fact in the existing runtime snapshot; old snapshots and unsupported optional diagnostic values remain readable by both runtime and observability consumers. No API schema, dependency, migration or database-head change is required.
  • The localized Test agent result rendering is synchronized on the existing frontend branch. Its normal fast-forward preserves the concurrent main merge and TabsIndicator changes. No additional PR or private dev history is added to this backend PR.

Validation: 1,098 related backend tests pass on the public candidate; after normally merging public main 158eeac85e, the unchanged API tree passes both modified test modules (219 tests) and static guards. The combined dev source passes 218 targeted cases on the original immutable Linux runtime and exact dependency/Graphon fingerprints. Its broader 1,098-case run passes 1,087; all 11 failures are reproduced on the original dev base (one unchanged history assertion and ten unchanged Langfuse configuration fixtures). The inherited limited SQLite Asset fixture receives its missing Tag tables only in the temporary harness; no production or test-source patch is added to dev for these baseline failures.

The combined dev frontend passes 39 focused browser cases. The frontend-only candidate passes 38 (its baseline lacks one unrelated dev precision regression), full Web typing, changed-file checks, 25 locale contracts and generated-type freshness.

Real dev browser acceptance passes 13 cases: the original public sample, eleven controlled reply/error cases, and the existing authenticated Task endpoint. Missing/invalid fields show precise maintainer guidance; malformed JSON, HTTP 403 and an ambiguous envelope keep conservative fallback; valid Message and Task replies succeed, and a subsequent successful run clears the old diagnosis. Endpoint counters prove exactly one business POST for each of the eleven explicit controlled runs and zero business POSTs during Verify.

Official build and deployment pass for deploy/agent at f5e90195dd. Nine runtime roles report the same revision with zero restarts. Dev keeps its existing changes, configuration, queues, Beat schedule, private migration lineage and original application graphs; public main is merged only into this PR branch.

The CI-only test follow-up explicitly narrows the synthetic interface URL and annotates the test JSON object. Both modified modules pass their actual strict Unit configuration and 219 regressions; the complete Unit type check subsequently passes in GitHub CI. Production code and the accepted dev runtime do not change.

The current public branch normally merges main f1002e05f0 at ff7a9f4420. The Native AgentConfig enum keeps its public component name through the new contracts owner, while all five External schema overrides remain intact. Conversation cleanup retains the trusted soft-deleted parent tenant fence before destructive work and main's retired Workspace collection after commit, including retry/orphan recovery. Generated oRPC routes and documentation come from the merged schemas through the official toolchain. Shared request, response and error schemas remain unchanged, and the two BYOA-only App operations are retained.

Validation passes 227 focused owner regressions, production and strict Unit typing, Ruff, eight guards against the actual staged merge tree, and independent deletion/schema reviews. A complete official regeneration compares 381 outputs with zero drift; 12,370 local schema references resolve, and the 171 API types/Zod/error files are byte-identical to the prior feature head. Existing workflow draft locking, reply diagnostics, dependency pins and the single BYOA migration remain intact.

The existing deploy/agent and feat/byoa-fe revisions are preserved. This PR has no merge conflicts. CI for ff7a9f4420 completed with 74 successful checks and 5 skipped checks.

Graphon dependency

Dify installs Graphon from its official repository. The vendor copy and its Docker context rules are removed. The API lock pins the 0.8 compatibility commit, based on Dify's existing 0.8 pin and carrying the same wait reason and Boolean default behavior. The generic wait reason is proposed for Graphon main in Graphon #446. Dify continues to own external task dispatch, persistence, deadlines, and resume policy.

Graphon #400 is already in Graphon 0.9.0. The compatibility commit stays on 0.8, so it does not include that fix. Dify #45356 owns the 0.9 migration. Retire the pin when Dify can adopt a release with the wait reason and validate checkpoints after nested streamed replies. Graphon #356

Validation: Dify ran 1,423 focused tests using a wheel built from the official Git commit. The installer metadata and imported package both resolve to the exact locked revision. The Docker dependency install plan resolves the same commit. All other locked packages are unchanged. Graphon passed 33 targeted tests on the 0.8 compatibility commit and 57 on each supported Python version for its 0.9 patch. CI for the updated Dify PR

@zyssyz123
zyssyz123 requested review from a team November 9, 2026 09:55
@github-actions github-actions Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. web This relates to changes on the web. labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-11-27 03:19:55.302086752 +0000
+++ /tmp/pyrefly_pr.txt	2026-11-27 03:19:44.822026843 +0000
@@ -1123,25 +1123,25 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/e2e_tests/containers/services/test_workflow_run_service.py:671:38
 ERROR Argument `str | None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-  --> tests/e2e_tests/containers/services/test_workflow_service.py:86:21
+  --> tests/e2e_tests/containers/services/test_workflow_service.py:94:21
 ERROR Argument `Literal['emoji']` is not assignable to parameter `icon_type` with type `IconType | SQLCoreOperations[IconType | None] | None` in function `models.model.App.__init__` [bad-argument-type]
-   --> tests/e2e_tests/containers/services/test_workflow_service.py:117:23
+   --> tests/e2e_tests/containers/services/test_workflow_service.py:125:23
 ERROR Argument `Literal['single-step']` is not assignable to parameter `value` with type `SQLCoreOperations[WorkflowNodeExecutionTriggeredFrom] | WorkflowNodeExecutionTriggeredFrom` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/e2e_tests/containers/services/test_workflow_service.py:186:41
+   --> tests/e2e_tests/containers/services/test_workflow_service.py:194:41
 ERROR Argument `Literal['succeeded']` is not assignable to parameter `value` with type `SQLCoreOperations[WorkflowNodeExecutionStatus] | WorkflowNodeExecutionStatus` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/e2e_tests/containers/services/test_workflow_service.py:191:33
+   --> tests/e2e_tests/containers/services/test_workflow_service.py:199:33
 ERROR Argument `Literal['invalid_mode']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-    --> tests/e2e_tests/containers/services/test_workflow_service.py:1391:20
+    --> tests/e2e_tests/containers/services/test_workflow_service.py:1399:20
 WARN Module `sqlalchemy.exc` exists, but was not imported explicitly. You are relying on other modules to load it. [implicit-import]
-    --> tests/e2e_tests/containers/services/test_workflow_service.py:1396:41
+    --> tests/e2e_tests/containers/services/test_workflow_service.py:1404:41
 ERROR `Literal['total_tokens']` is not assignable to dict key type `WorkflowNodeExecutionMetadataKey` [bad-assignment]
-    --> tests/e2e_tests/containers/services/test_workflow_service.py:1739:27
+    --> tests/e2e_tests/containers/services/test_workflow_service.py:1747:27
 ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunSucceededEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
-    --> tests/e2e_tests/containers/services/test_workflow_service.py:1761:28
+    --> tests/e2e_tests/containers/services/test_workflow_service.py:1769:28
 ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
-    --> tests/e2e_tests/containers/services/test_workflow_service.py:1829:28
+    --> tests/e2e_tests/containers/services/test_workflow_service.py:1837:28
 ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
-    --> tests/e2e_tests/containers/services/test_workflow_service.py:1896:28
+    --> tests/e2e_tests/containers/services/test_workflow_service.py:1904:28
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/e2e_tests/containers/services/tools/test_mcp_tools_manage_service.py:63: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]
@@ -1614,6 +1614,130 @@
    --> tests/e2e_tests/contracts/libs/_human_input/test_models.py:120:16
 ERROR `<=` is not supported between `None` and `datetime` [unsupported-operation]
    --> tests/e2e_tests/contracts/libs/_human_input/test_models.py:120:16
+ERROR Keyword argument `agent_id` with type `str | None` is not assignable to parameter `**kwargs` with type `str` in function `typing.MutableMapping.update` [bad-argument-type]
+  --> tests/e2e_tests/external_agents/connection_matrix_acceptance.py:34:37
+ERROR Argument `tuple[Any, ...]` is not assignable to parameter `head` with type `str` in function `alembic.script.base.ScriptDirectory.walk_revisions` [bad-argument-type]
+   --> tests/e2e_tests/external_agents/mysql_runtime_acceptance.py:207:105
+ERROR Argument `tuple[dict[str, str], ...]` is not assignable to parameter `parts` with type `tuple[dict[str, bool | dict[str, JsonValue] | float | int | list[JsonValue] | str | None], ...]` in function `services.external_agents.protocol.SendRequest.__init__` [bad-argument-type]
+  --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:75:19
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `str` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `list[JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `str` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `list[JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `list[JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `str` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:21
+ERROR Cannot index into `dict[str, JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:52
+ERROR Cannot index into `dict[str, JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:100:64
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `str` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `list[JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Argument `Unknown | JsonValue` is not assignable to parameter `s` with type `Buffer | str` in function `base64.b64decode` [bad-argument-type]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `str` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `bool` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `float` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `int` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `list[JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR `None` is not subscriptable [unsupported-operation]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:38
+ERROR Cannot index into `dict[str, JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:69
+ERROR Cannot index into `dict[str, JsonValue]` [bad-index]
+   --> tests/e2e_tests/external_agents/official_sdk_gateway_smoke.py:105:81
+ERROR Cannot find module `a2a.server.agent_execution` [missing-import]
+  --> tests/e2e_tests/external_agents/official_sdk_server.py:22:1
+ERROR Cannot find module `a2a.server.events` [missing-import]
+  --> tests/e2e_tests/external_agents/official_sdk_server.py:23:1
+ERROR Cannot find module `a2a.server.request_handlers` [missing-import]
+  --> tests/e2e_tests/external_agents/official_sdk_server.py:24:1
+ERROR Cannot find module `a2a.server.routes.agent_card_routes` [missing-import]
+  --> tests/e2e_tests/external_agents/official_sdk_server.py:25:1
+ERROR Cannot find module `a2a.server.routes.rest_routes` [missing-import]
+  --> tests/e2e_tests/external_agents/official_sdk_server.py:26:1
+ERROR Cannot find module `a2a.server.tasks` [missing-import]
+  --> tests/e2e_tests/external_agents/official_sdk_server.py:27:1
+ERROR Cannot find module `a2a.types` [missing-import]
+  --> tests/e2e_tests/external_agents/official_sdk_server.py:28:1
+ERROR Class member `CountRequests.dispatch` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
+   --> tests/e2e_tests/external_agents/official_sdk_server.py:165:15
 ERROR `*` is not supported between `float` and `str` [unsupported-operation]
   --> tests/e2e_tests/knowledge_fs_vector/test_backends.py:54:37
 ERROR `*` is not supported between `str` and `float` [unsupported-operation]
@@ -3303,93 +3427,93 @@
 ERROR Argument `Literal['session']` is not assignable to parameter `type` with type `EndUserType | SQLCoreOperations[EndUserType]` in function `models.model.EndUser.__init__` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/test_streaming_utils.py:527:67
 ERROR Argument `Mapping[str, Any] | None` is not assignable to parameter `graph_config` with type `Mapping[str, Any]` in function `core.workflow.workflow_entry.WorkflowEntry.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:145:39
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:161:39
 ERROR No matching overload found for function `dict.get` called with arguments: (dict[str, int | list[Unknown] | str] | dict[str, list[str] | str] | dict[str, list[Unknown] | str] | dict[str, str] | str, Literal['']) [no-matching-overload]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:190:27
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:206:27
 ERROR Cannot set item in `str` [unsupported-operation]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:192:13
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:208:13
 ERROR Cannot set item in `str` [unsupported-operation]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:195:13
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:211:13
 ERROR Cannot set item in `str` [unsupported-operation]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:200:13
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:216:13
 ERROR Cannot set item in `str` [unsupported-operation]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:202:17
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:218:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:276:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:292:59
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:283:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:299:59
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:319:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:367:59
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:356:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:404:59
 ERROR Argument `Mapping[str, Any] | None` is not assignable to parameter `graph_config` with type `Mapping[str, Any]` in function `graphon.graph.graph.Graph.init` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:375:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:423:30
 ERROR Argument `NodeFactory | None` is not assignable to parameter `node_factory` with type `NodeFactory` in function `graphon.graph.graph.Graph.init` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:376:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:424:30
 ERROR Argument `Mapping[str, Any] | None` is not assignable to parameter `graph_config` with type `Mapping[str, Any]` in function `graphon.graph.graph.Graph.init` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:382:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:430:30
 ERROR Argument `NodeFactory | None` is not assignable to parameter `node_factory` with type `NodeFactory` in function `graphon.graph.graph.Graph.init` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:383:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:431:30
 ERROR Argument `Mapping[str, Any] | None` is not assignable to parameter `graph_config` with type `Mapping[str, Any]` in function `graphon.graph.graph.Graph.init` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:389:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:437:30
 ERROR Argument `NodeFactory | None` is not assignable to parameter `node_factory` with type `NodeFactory` in function `graphon.graph.graph.Graph.init` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:390:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:438:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:398:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:446:59
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:410:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:458:59
 ERROR Argument `Mapping[str, Any] | None` is not assignable to parameter `graph_config` with type `Mapping[str, Any]` in function `graphon.graph.graph.Graph.init` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:434:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:482:30
 ERROR Argument `NodeFactory | None` is not assignable to parameter `node_factory` with type `NodeFactory` in function `graphon.graph.graph.Graph.init` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:435:30
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:483:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:444:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:492:59
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner._get_graph_and_variable_pool_for_single_node_run` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:490:26
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:538:26
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:511:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:559:59
 ERROR Argument `dict[str, list[dict[str, str | dict[str, str]]] | list[Unknown]]` is not assignable to parameter `graph` with type `dict[str, object] | None` in function `_workflow` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:521:34
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:569:34
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:579:31
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:627:31
 ERROR Object of class `NoneType` has no attribute `value` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:644:20
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:692:20
 ERROR Argument `TestWorkflowAppRunnerCoreCases.TestWorkflowBasedAppRunner.test_handle_graph_run_events_and_pause_notifications._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:653:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:701:59
 ERROR Type `object` is not iterable [not-iterable]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:690:73
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:738:73
 ERROR Type `object` is not iterable [not-iterable]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:691:75
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:739:75
 ERROR Type `object` is not iterable [not-iterable]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:692:43
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:740:43
 ERROR Argument `TestWorkflowAppRunnerCoreCases.TestWorkflowBasedAppRunner.test_handle_graph_aborted_publishes_stopped_terminal._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:704:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:752:59
 ERROR Argument `TestWorkflowAppRunnerCoreCases.TestWorkflowBasedAppRunner.test_handle_node_events_publishes_queue_events._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:720:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:768:59
 ERROR Object of class `object` has no attribute `metadata` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:838:64
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:886:64
 ERROR Argument `TestWorkflowAppRunnerCoreCases.TestWorkflowBasedAppRunner.test_nested_engine_events_retain_both_container_ancestors._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:841:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:889:59
 ERROR Argument `Mapping[str, Any] | None` is not assignable to parameter `graph_config` with type `Mapping[str, Any]` in function `core.workflow.workflow_entry.WorkflowEntry.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:849:48
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:897:48
 ERROR Object of class `object` has no attribute `node_id` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:866:26
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:914:26
 ERROR Object of class `object` has no attribute `metadata` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:869:61
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:917:61
 ERROR Object of class `object` has no attribute `metadata` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:871:60
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:919:60
 ERROR Argument `TestWorkflowAppRunnerCoreCases.TestWorkflowBasedAppRunner.test_handle_nested_answer_success_publishes_text_chunk._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:893:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:941:59
 ERROR `Literal['iteration_id']` is not assignable to dict key type `WorkflowNodeExecutionMetadataKey` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:905:75
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:953:75
 ERROR Argument `TestWorkflowAppRunnerCoreCases.TestWorkflowBasedAppRunner.test_handle_root_answer_success_does_not_publish_extra_text_chunk._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:925:59
+   --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:973:59
 ERROR Argument `TestWorkflowAppRunnerCoreCases.TestWorkflowBasedAppRunner.test_handle_start_node_result_events_project_outputs._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1004:59
+    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1052:59
 ERROR Argument `_DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1056:55
+    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1104:55
 ERROR Argument `_DummyWorkflowEntry` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.handle_event` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1073:29
+    --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1121:29
 ERROR Argument `tuple[Literal['layer']]` is not assignable to parameter `graph_engine_layers` with type `Sequence[Layer]` in function `core.app.apps.workflow.app_generator.WorkflowAppGenerator.resume` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/workflow/test_app_generator.py:643:33
 ERROR Argument `tuple[Literal['base-layer']]` is not assignable to parameter `graph_engine_layers` with type `Sequence[Layer]` in function `core.app.apps.workflow.app_generator.WorkflowAppGenerator._generate` [bad-argument-type]
@@ -4698,53 +4822,53 @@
 ERROR Cannot index into `object` [bad-index]
    --> tests/unit_tests/core/workflow/nodes/trigger_webhook/test_node.py:511:12
 ERROR Argument `SimpleNamespace` is not assignable to parameter `runtime_state` with type `RuntimeState` in function `core.workflow.node_factory.DifyNodeFactory.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:125:31
+   --> tests/unit_tests/core/workflow/test_node_factory.py:117:31
 ERROR Class member `_Version1.init_node_data` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:257:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:249:17
 ERROR Class member `_Version1._get_error_strategy` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:267:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:259:17
 ERROR Class member `_Version1._get_retry_config` overrides parent class `Node` in an inconsistent manner [bad-override]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:270:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:262:17
 ERROR Class member `_Version1._get_retry_config` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:270:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:262:17
 ERROR Class member `_Version1._get_title` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:273:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:265:17
 ERROR Class member `_Version1._get_description` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:276:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:268:17
 ERROR Class member `_Version1._get_default_value_dict` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:279:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:271:17
 ERROR Class member `_Version2.version` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:287:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:279:17
 ERROR Class member `_Version2._get_title` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:290:17
+   --> tests/unit_tests/core/workflow/test_node_factory.py:282:17
 ERROR `object` is not assignable to attribute `model_runtime` with type `LLMModelRuntime` [bad-assignment]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:351:30
+   --> tests/unit_tests/core/workflow/test_node_factory.py:343:30
 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/core/workflow/test_node_factory.py:379:60
+   --> tests/unit_tests/core/workflow/test_node_factory.py:371:60
 ERROR Argument `object` is not assignable to parameter `node_data_memory` with type `MemoryConfig | None` in function `core.workflow.node_factory.fetch_memory` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:443:34
+   --> tests/unit_tests/core/workflow/test_node_factory.py:435:34
 ERROR Argument `object` is not assignable to parameter `node_data_memory` with type `MemoryConfig | None` in function `core.workflow.node_factory.fetch_memory` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:460:34
+   --> tests/unit_tests/core/workflow/test_node_factory.py:452:34
 ERROR Argument `object` is not assignable to parameter `node_data_memory` with type `MemoryConfig | None` in function `core.workflow.node_factory.fetch_memory` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:486:34
+   --> tests/unit_tests/core/workflow/test_node_factory.py:478:34
 ERROR `None` is not assignable to dict key `sourceHandle` with type `str` [bad-assignment]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:548:60
+   --> tests/unit_tests/core/workflow/test_node_factory.py:540:60
 ERROR `SimpleNamespace` is not assignable to attribute `runtime_state` with type `RuntimeState` [bad-assignment]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:670:37
+   --> tests/unit_tests/core/workflow/test_node_factory.py:662:37
 ERROR `SimpleNamespace` is not assignable to attribute `_dify_context` with type `DifyRunContext` [bad-assignment]
-   --> tests/unit_tests/core/workflow/test_node_factory.py:671:37
+   --> tests/unit_tests/core/workflow/test_node_factory.py:663:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `node_data` with type `LLMNodeData | ParameterExtractorNodeData | QuestionClassifierNodeData` in function `core.workflow.node_factory.DifyNodeFactory._wrap_model_instance_for_node` [bad-argument-type]
-    --> tests/unit_tests/core/workflow/test_node_factory.py:1136:27
+    --> tests/unit_tests/core/workflow/test_node_factory.py:1128:27
 ERROR Argument `_ModelInstanceStub` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_factory.DifyNodeFactory._wrap_model_instance_for_node` [bad-argument-type]
-    --> tests/unit_tests/core/workflow/test_node_factory.py:1137:32
+    --> tests/unit_tests/core/workflow/test_node_factory.py:1129:32
 ERROR `SimpleNamespace` is not assignable to attribute `runtime_state` with type `RuntimeState` [bad-assignment]
-    --> tests/unit_tests/core/workflow/test_node_factory.py:1393:37
+    --> tests/unit_tests/core/workflow/test_node_factory.py:1385:37
 ERROR Argument `list[dict[str, str] | str]` is not assignable to parameter `value` with type `Sequence[Mapping[str, Any]]` in function `graphon.variables.segments.ArrayObjectSegment.model_construct` [bad-argument-type]
-    --> tests/unit_tests/core/workflow/test_node_factory.py:1438:23
+    --> tests/unit_tests/core/workflow/test_node_factory.py:1430:23
 ERROR `SimpleNamespace` is not assignable to attribute `_dify_context` with type `DifyRunContext` [bad-assignment]
-    --> tests/unit_tests/core/workflow/test_node_factory.py:1521:37
+    --> tests/unit_tests/core/workflow/test_node_factory.py:1513:37
 ERROR `SimpleNamespace` is not assignable to attribute `runtime_state` with type `RuntimeState` [bad-assignment]
-    --> tests/unit_tests/core/workflow/test_node_factory.py:1522:37
+    --> tests/unit_tests/core/workflow/test_node_factory.py:1514:37
 ERROR Object of class `object` has no attribute `parent_trace_context` [missing-attribute]
     --> tests/unit_tests/core/workflow/test_node_runtime.py:1184:16
 ERROR Object of class `object` has no attribute `trace_session_id` [missing-attribute]
@@ -4853,34 +4977,14 @@
    --> tests/unit_tests/dev/test_generate_knowledge_fs_contract.py:232:5
 ERROR `object` is not assignable to dict key `security` with type `dict[str, dict[str, dict[str, object]]]` [bad-assignment]
    --> tests/unit_tests/dev/test_generate_knowledge_fs_contract.py:660:32
-ERROR Object of class `NoneType` has no attribute `partition` [missing-attribute]
-  --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:58:34
-ERROR `<=` is not supported between `None` and `int` [unsupported-operation]
-  --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:62:16
-ERROR Cannot instantiate `LogstoreAPIWorkflowNodeExecutionRepository` because the following members are abstract: `delete_expired_executions`, `count_by_runs`, `delete_by_runs`, `get_expired_executions_batch`, `delete_executions_by_ids`, `get_offloads_by_execution_ids` [bad-instantiation]
-  --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:67:60
-ERROR Cannot instantiate `LogstoreAPIWorkflowNodeExecutionRepository` because the following members are abstract: `delete_expired_executions`, `count_by_runs`, `delete_by_runs`, `get_expired_executions_batch`, `delete_executions_by_ids`, `get_offloads_by_execution_ids` [bad-instantiation]
-   --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:129:64
-ERROR Cannot instantiate `LogstoreAPIWorkflowNodeExecutionRepository` because the following members are abstract: `delete_expired_executions`, `count_by_runs`, `delete_by_runs`, `get_expired_executions_batch`, `delete_executions_by_ids`, `get_offloads_by_execution_ids` [bad-instantiation]
-   --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:145:64
-ERROR `None` is not assignable to dict value type `float | int | str` [bad-assignment]
-   --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:173:101
-ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
-   --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:192:5
-ERROR Object of class `FunctionType` has no attribute `call_count` [missing-attribute]
-   --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:214:12
-ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:215:13
-ERROR Cannot instantiate `LogstoreAPIWorkflowNodeExecutionRepository` because the following members are abstract: `delete_expired_executions`, `count_by_runs`, `delete_by_runs`, `get_expired_executions_batch`, `delete_executions_by_ids`, `get_offloads_by_execution_ids` [bad-instantiation]
-   --> tests/unit_tests/extensions/logstore/repositories/test_logstore_api_workflow_node_execution_repository.py:338:64
 ERROR Object of class `Connection` has no attribute `SimpleQueue` [missing-attribute]
-   --> tests/unit_tests/extensions/test_ext_celery.py:142:14
+   --> tests/unit_tests/extensions/test_ext_celery.py:243:14
 ERROR Object of class `Connection` has no attribute `SimpleQueue` [missing-attribute]
-   --> tests/unit_tests/extensions/test_ext_celery.py:151:18
+   --> tests/unit_tests/extensions/test_ext_celery.py:252:18
 ERROR Object of class `Connection` has no attribute `SimpleQueue` [missing-attribute]
-   --> tests/unit_tests/extensions/test_ext_celery.py:172:18
+   --> tests/unit_tests/extensions/test_ext_celery.py:273:18
 ERROR Object of class `Connection` has no attribute `SimpleQueue` [missing-attribute]
-   --> tests/unit_tests/extensions/test_ext_celery.py:177:18
+   --> tests/unit_tests/extensions/test_ext_celery.py:278:18
 ERROR Object of class `Subscription` has no attribute `_start_if_needed` [missing-attribute]
    --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:174:13
 ERROR Object of class `Subscription` has no attribute `_start_if_needed` [missing-attribute]
@@ -5044,9 +5148,9 @@
 ERROR `in` is not supported between `Literal['real_file_id']` and `None` [not-iterable]
    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_transform_service.py:494:12
 ERROR Argument `FakeRepo` is not assignable to parameter `workflow_run_repo` with type `APIWorkflowRunRepository | None` in function `services.retention.workflow_run.clear_free_plan_expired_workflow_run_logs.WorkflowRunCleanup.__init__` [bad-argument-type]
-   --> tests/unit_tests/services/retention/workflow_run/test_clear_free_plan_expired_workflow_run_logs.py:565:49
+   --> tests/unit_tests/services/retention/workflow_run/test_clear_free_plan_expired_workflow_run_logs.py:578:49
 ERROR Class member `FailingRepo.delete_runs_with_related_by_ids` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-   --> tests/unit_tests/services/retention/workflow_run/test_clear_free_plan_expired_workflow_run_logs.py:865:17
+   --> tests/unit_tests/services/retention/workflow_run/test_clear_free_plan_expired_workflow_run_logs.py:878:17
 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/services/retention/workflow_run/test_restore_archived_workflow_run.py:58:16
 ERROR Argument `str` is not assignable to parameter `type` with type `SQLCoreOperations[WorkflowType] | WorkflowType` in function `models.workflow.WorkflowRun.__init__` [bad-argument-type]

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 87.92% 88.18% +0.26%
Strict coverage 87.58% 87.85% +0.27%
Typed symbols 97,323 101,438 +4,115
Untyped symbols 13,426 13,652 +226
Modules 4672 4805 +133

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.27238% with 493 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.54%. Comparing base (f1002e0) to head (575e15d).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...repositories/external_agents/runtime_repository.py 81.56% 53 Missing and 48 partials ⚠️
api/services/external_agents/invocation_service.py 89.26% 16 Missing and 16 partials ⚠️
...i/repositories/external_agents/asset_repository.py 90.76% 20 Missing and 10 partials ⚠️
api/core/workflow/nodes/agent_v2/validators.py 25.00% 25 Missing and 2 partials ⚠️
...ories/external_agents/file_lifecycle_repository.py 85.23% 13 Missing and 9 partials ⚠️
api/services/external_agents/trace_content.py 82.05% 12 Missing and 9 partials ⚠️
api/services/external_agents/tracing_config.py 94.20% 12 Missing and 3 partials ⚠️
.../repositories/external_agents/workflow_bindings.py 87.03% 7 Missing and 7 partials ⚠️
api/services/external_agents/invocation_agg.py 88.61% 6 Missing and 8 partials ⚠️
api/providers/a2a/runtime_io.py 90.29% 6 Missing and 4 partials ⚠️
... and 39 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #45918      +/-   ##
==========================================
+ Coverage   90.52%   90.54%   +0.02%     
==========================================
  Files        6608     6661      +53     
  Lines      410728   418490    +7762     
  Branches    82412    83216     +804     
==========================================
+ Hits       371825   378937    +7112     
- Misses      32503    32912     +409     
- Partials     6400     6641     +241     
Flag Coverage Δ
api 90.29% <93.05%> (+0.08%) ⬆️
cli 94.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:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zyssyz123
zyssyz123 requested a review from WH-2099 as a code owner November 10, 2026 04:52
@zyssyz123
zyssyz123 requested a review from JohnJyong as a code owner November 25, 2026 03:33
…dify-3025-byoa-backend-20261109

# Conflicts:
#	api/services/workflow_service.py
#	api/tests/e2e_tests/containers/services/test_workflow_service.py
…ttps://github.com/langgenius/dify into codex/dify-3025-byoa-backend-20261109

# Conflicts:
#	api/controllers/common/schema.py
#	api/tasks/delete_conversation_task.py
#	packages/contracts/generated/api/console/apps/orpc.gen.ts
@zyssyz123
zyssyz123 enabled auto-merge November 27, 2026 02:53

@MRZHUH MRZHUH 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.

Please address the Beat scheduling issue before the SaaS rollout.


# if you add a new task, please add the switch to CeleryScheduleTasksConfig
beat_schedule: dict[str, CeleryBeatScheduleEntry] = {}
beat_schedule["external_agent_commands"] = {

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.

Please gate both Beat entries on EXTERNAL_AGENTS_ENABLED. With the flag off, Beat still publishes a drain task every 5 seconds and a maintenance task every 60 seconds by default. A SaaS deployment that upgrades Beat without enabling the dedicated worker would enqueue 18,720 messages per day per Beat instance. On a Redis broker, expires alone does not remove messages from an unconsumed queue. Please add a regression test that verifies both entries are absent when the feature is disabled. If post-disable cleanup is required, please make that an explicit mode with a consumer.

Comment thread api/pyproject.toml Outdated
# shortcut: pin the 0.8.0 container-type fix until a release includes graphon#344.
graphon = { git = "https://github.com/langgenius/graphon", rev = "4fa22141774dff80e90e4dfa98ea3e6fbf0421bb" }
# Reviewed source vendor: pinned upstream plus the generic ExternalWait reason.
graphon = { path = "../packages/graphon" }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe the changes to graphon should be migrated to langgenius/graphon. Vendoring Graphon and essentially creates a fork, which is a maintenance nightmare.

For example: the langgenius/graphon#400 fixes a critical performance issue, and it is not included in this vendored version.

@@ -0,0 +1,91 @@
"""Dify's finite remote-reported call-total profile, not an A2A standard or billing authority.

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.

Could we move a2a out of api/providers? That directory is for optional uv workspace packages that implement a core interface, encapsulate vendor-specific dependencies, and can be omitted without changing application logic. A2A is required for BYOA to function, so it belongs with the BYOA implementation rather than under providers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ 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.

5 participants