fix: improve error handling for workflow execution (#37919) - #40885
Draft
wylswz wants to merge 1 commit into
Draft
fix: improve error handling for workflow execution (#37919)#40885wylswz wants to merge 1 commit into
wylswz wants to merge 1 commit into
Conversation
(cherry picked from commit b33e8f0)
wylswz
requested review from
CodingOnStar,
QuantumGhost,
hyoban,
iamjoel,
laipz8200 and
zxhlyh
as code owners
August 17, 2026 11:04
wylswz
marked this pull request as draft
August 17, 2026 11:04
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-08-17 11:06:04.617522831 +0000
+++ /tmp/pyrefly_pr.txt 2026-08-17 11:05:50.583506291 +0000
@@ -483,9 +483,9 @@
ERROR Object of class `dict` has no attribute `encode`
ERROR Object of class `dict` has no attribute `encode`
ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Generator[Mapping[str, Any] | str, Any] | Mapping[str, Any]` [unsafe-overlap]
- --> tasks/app_generate/workflow_execute_task.py:435:37
+ --> tasks/app_generate/workflow_execute_task.py:636:33
ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` [unsafe-overlap]
- --> tasks/app_generate/workflow_execute_task.py:489:37
+ --> tasks/app_generate/workflow_execute_task.py:698:33
ERROR `Literal['error']` is not assignable to attribute `status` with type `Never` [bad-assignment]
--> tasks/regenerate_summary_index_task.py:278:61
ERROR `str` is not assignable to attribute `error` with type `Never` [bad-assignment]
@@ -7201,12 +7201,130 @@
--> tests/unit_tests/tasks/test_mail_send_task.py:1299:67
ERROR Argument `dict[str, bool]` is not assignable to parameter `substitutions` with type `Mapping[str, str]` in function `tasks.mail_inner_task._render_template_with_strategy` [bad-argument-type]
--> tests/unit_tests/tasks/test_mail_send_task.py:1300:64
-ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
- --> tests/unit_tests/tasks/test_workflow_execute_task.py:55:33
-ERROR Argument `UUID` is not assignable to parameter `workflow_run_id` with type `str` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
- --> tests/unit_tests/tasks/test_workflow_execute_task.py:55:50
-ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
- --> tests/unit_tests/tasks/test_workflow_execute_task.py:65:33
+ERROR Argument `object` is not assignable to parameter `event` with type `BaseModel | Mapping[str, Any] | str` in function `tasks.app_generate.workflow_execute_task._get_event_name` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:97:57
+ERROR Argument `object` is not assignable to parameter `event` with type `BaseModel | Mapping[str, Any] | str` in function `tasks.app_generate.workflow_execute_task._get_task_id` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:113:54
+ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[BaseModel | Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:136:9
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:145:13
+ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[BaseModel | Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:153:9
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:162:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:184:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:185:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:185:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:186:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:186:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:187:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:187:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:188:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:188:12
+ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[BaseModel | Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:214:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:222:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:223:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:224:23
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:224:23
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:225:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:226:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:226:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:227:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:227:12
+ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[BaseModel | Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:260:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:268:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:269:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:270:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:270:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:271:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:271:12
+ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[BaseModel | Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:304:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:312:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:313:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:314:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:314:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:315:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:315:12
+ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[BaseModel | Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:337:9
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:346:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:347:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:348:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:348:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:349:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:349:12
+ERROR Argument `Iterator[Any]` is not assignable to parameter `response_stream` with type `Generator[BaseModel | Mapping[str, Any] | str]` in function `tasks.app_generate.workflow_execute_task._publish_streaming_response` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:387:9
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:396:13
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:489:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:489:12
+ERROR Cannot index into `str` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:490:12
+ERROR Cannot index into `object` [bad-index]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:490:12
+ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `tasks.app_generate.workflow_execute_task._resume_advanced_chat` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:699:19
+ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `tasks.app_generate.workflow_execute_task._resume_advanced_chat` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:700:18
+ERROR Argument `SimpleNamespace` is not assignable to parameter `conversation` with type `Conversation` in function `tasks.app_generate.workflow_execute_task._resume_advanced_chat` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:702:22
+ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_run` with type `WorkflowRun` in function `tasks.app_generate.workflow_execute_task._resume_advanced_chat` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:709:22
+ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `tasks.app_generate.workflow_execute_task._resume_workflow` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:752:19
+ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `tasks.app_generate.workflow_execute_task._resume_workflow` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:753:18
+ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_run` with type `WorkflowRun` in function `tasks.app_generate.workflow_execute_task._resume_workflow` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:760:22
+ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `tasks.app_generate.workflow_execute_task._resume_workflow` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:807:19
+ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `tasks.app_generate.workflow_execute_task._resume_workflow` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:808:18
+ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow_run` with type `WorkflowRun` in function `tasks.app_generate.workflow_execute_task._resume_workflow` [bad-argument-type]
+ --> tests/unit_tests/tasks/test_workflow_execute_task.py:815:22
ERROR Object of class `BlobChunkMessage` has no attribute `variable_name`
ERROR Object of class `BlobChunkMessage` has no attribute `variable_name`
ERROR Object of class `BlobChunkMessage` has no attribute `variable_value`
|
Contributor
Pyrefly Type Coverage
|
wylswz
commented
Aug 17, 2026
| workflow_run_id: str, | ||
| workflow_run: WorkflowRun, | ||
| ) -> None: | ||
| resumed_generate_entity = generate_entity.model_copy(update={"stream": True}) |
Contributor
Author
There was a problem hiding this comment.
This line is introduced when resolving conflicts, introduced by #32826
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(cherry picked from commit b33e8f0)
Important
Fixes #<issue number>.Summary
Screenshots
Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint gods