Change the is_resumption field in WorkflowStarted event into reason (vibe-kanban 19ac040e)

Reason should be an enumeration with only one member `resumption` currently.

Please update these part of events:

- Graph / Engine Event (GraphRunStartedEvent)
- Queue event (QueueWorkflowStartedEvent)
- SSE response event (WorkflowStartStreamResponse)

Besides, you should remove the `is_resumption` flag for `node_started` events; including:

- Queue Event (`QueueNodeStartedEvent`)
- SSE Event (`NodeStartStreamResponse`)
- Node event (`NodeRunStartedEvent`)

After finishing the changes above, adjust related tests.
You should run the affected tests and ensure they can pass. (You should use `uv run pytest` to run tests)
This commit is contained in:
QuantumGhost
2026-01-18 21:00:25 +08:00
parent 7bc7a8d0ab
commit afdf2397f2
21 changed files with 59 additions and 227 deletions

View File

@ -315,7 +315,7 @@ class AdvancedChatAppGenerateTaskPipeline(GraphRuntimeStateSupport):
task_id=self._application_generate_entity.task_id,
workflow_run_id=run_id,
workflow_id=self._workflow_id,
is_resumption=event.is_resumption,
reason=event.reason,
)
yield workflow_start_resp

View File

@ -47,6 +47,7 @@ from core.tools.tool_manager import ToolManager
from core.trigger.trigger_manager import TriggerManager
from core.variables.segments import ArrayFileSegment, FileSegment, Segment
from core.workflow.entities.pause_reason import HumanInputRequired
from core.workflow.entities.workflow_start_reason import WorkflowStartReason
from core.workflow.enums import (
NodeType,
SystemVariableKey,
@ -199,7 +200,7 @@ class WorkflowResponseConverter:
task_id: str,
workflow_run_id: str,
workflow_id: str,
is_resumption: bool,
reason: WorkflowStartReason,
) -> WorkflowStartStreamResponse:
run_id = self._ensure_workflow_run_id(workflow_run_id)
started_at = naive_utc_now()
@ -213,7 +214,7 @@ class WorkflowResponseConverter:
workflow_id=workflow_id,
inputs=self._workflow_inputs,
created_at=int(started_at.timestamp()),
is_resumption=is_resumption,
reason=reason,
),
)
@ -410,7 +411,6 @@ class WorkflowResponseConverter:
iteration_id=event.in_iteration_id,
loop_id=event.in_loop_id,
agent_strategy=event.agent_strategy,
is_resumption=event.is_resumption,
),
)

View File

@ -272,7 +272,7 @@ class WorkflowAppGenerateTaskPipeline(GraphRuntimeStateSupport):
task_id=self._application_generate_entity.task_id,
workflow_run_id=run_id,
workflow_id=self._workflow.id,
is_resumption=event.is_resumption,
reason=event.reason,
)
yield start_resp

View File

@ -359,7 +359,7 @@ class WorkflowBasedAppRunner:
:param event: event
"""
if isinstance(event, GraphRunStartedEvent):
self._publish_event(QueueWorkflowStartedEvent(is_resumption=event.is_resumption))
self._publish_event(QueueWorkflowStartedEvent(reason=event.reason))
elif isinstance(event, GraphRunSucceededEvent):
self._publish_event(QueueWorkflowSucceededEvent(outputs=event.outputs))
elif isinstance(event, GraphRunPartialSucceededEvent):
@ -431,7 +431,6 @@ class WorkflowBasedAppRunner:
agent_strategy=event.agent_strategy,
provider_type=event.provider_type,
provider_id=event.provider_id,
is_resumption=event.is_resumption,
)
)
elif isinstance(event, NodeRunSucceededEvent):