Fix workflow execution state reconciliation#9199
Conversation
2aadadc to
c60ee2a
Compare
c60ee2a to
61c33bc
Compare
Findings
Open Questions
|
|
On the event-ordering question: I am treating queue and invocation events as interleavable. I am not relying on the backend to emit every On the reconciliation request question: I kept the reconciliation fetch as a one-shot Fixes:
|
fb7ca12 to
4c13888
Compare
4c13888 to
22b31ae
Compare
Summary
Fixes stale frontend workflow execution state when fast workflows complete before all socket events are reflected in the workflow editor.
This is best done with a formal state model, so this PR adds a small workflow execution state model for queue and invocation events. Socket events now pass through the model before mutating node execution state, and completed workflow queue items are reconciled from the authoritative persisted session.
nullqueue_item_status_changed: pendingpendingnullqueue_item_status_changed: in_progressin_progressnullqueue_item_status_changed: completedcompletednullqueue_item_status_changed: failedfailednullqueue_item_status_changed: canceledcanceledpendingqueue_item_status_changed: in_progressin_progresspendingqueue_item_status_changed: completedcompletedpendingqueue_item_status_changed: failedfailedpendingqueue_item_status_changed: canceledcanceledin_progressqueue_item_status_changed: completedcompletedin_progressqueue_item_status_changed: failedfailedin_progressqueue_item_status_changed: canceledcanceledcompletedqueue_item_status_changed: pendingcompletedqueue_item_status_changed: in_progressfailedqueue_item_status_changed: pendingfailedqueue_item_status_changed: in_progresscanceledqueue_item_status_changed: pendingcanceledqueue_item_status_changed: in_progressunknowninvocation_startedin_progressunknowninvocation_progressin_progressunknowninvocation_completecompletedunknowninvocation_errorfailedin_progressinvocation_completecompletedin_progressinvocation_errorfailedcompletedinvocation_startedcompletedinvocation_progresscompletedinvocation_errorfailedinvocation_startedfailedinvocation_progressfailedinvocation_completecompletedinvocation_completecompletedcompletedinvocation_startedcompletedinvocation_progresscompletedinvocation_errorfailedinvocation_errorfailedfailedinvocation_startedfailedinvocation_progressfailedinvocation_completecanceledcompleted_session_reconciledcompleted; mark persisted prepared invocation IDscompleted; rebuild node outputs from sessionRelated Issues / Discussions
This attempts to finally resolve issues with execution state partially resolved in #9043 and others.
QA Instructions
Run tests from
invokeai/frontend/web:pnpm exec vitest run src/services/events/workflowExecutionState.test.ts src/services/events/nodeExecutionState.test.ts src/services/events/invocationTracking.test.tsMerge Plan
Normal merge.
Checklist
What's Newcopy (if doing a release after this PR)