fix(sessions): terminalize session on workflow completion
DefaultSessionReducer skipped WorkflowCompletedEvent to avoid terminalizing on freestyle planning's mid-session completion, but that left execution/normal completions stuck ACTIVE forever — headless watchers and approval loops never saw a terminal state. Add workflowId to WorkflowCompletedEvent (defaulted for replay compat), pass graph.id at all completeWorkflow sites, and terminalize to COMPLETED unless it's the freestyle_planning handoff. Correct stale tests that pinned the ACTIVE-forever behavior.
This commit is contained in:
@@ -21,6 +21,10 @@ data class WorkflowCompletedEvent(
|
||||
val sessionId: SessionId,
|
||||
val terminalStageId: StageId,
|
||||
val totalStages: Int,
|
||||
// The workflow that completed. Lets the session reducer tell a session-terminal completion from
|
||||
// the freestyle planning workflow, which completes mid-session before handing off to execution.
|
||||
// Defaulted for backward-compatible replay of events stored before this field existed.
|
||||
val workflowId: String = "",
|
||||
) : EventPayload
|
||||
|
||||
@Serializable
|
||||
|
||||
Reference in New Issue
Block a user