WorkflowExecutionService: job mode does not process trigger messages synchronously
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3573704. --> Reported by: [stmh](https://www.drupal.org/user/35538) Related to !3 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p> In <code>WorkflowExecutionService::executeImmediate()</code>, job mode creates a trigger message via <code>createTriggerMessage()</code> but never calls<br> <code>SessionService::processMessage()</code> on it. Instead it falls through directly to <code>waitForCompletion()</code> polling. This means the workflow is never actually executed<br> synchronously &mdash; it relies entirely on an external consumer (e.g. cron, queue worker) to pick up and process the message, causing unnecessary delays or outright failures when no such<br> consumer is running.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <ol> <li>Execute a workflow in job mode (the default) via <code>WorkflowExecutionService::execute()</code></li> <li>Observe that the trigger message is created but <code>processMessage()</code> is never called</li> <li><code>waitForCompletion()</code> polls but the workflow never completes unless an external message processor is active</li> </ol> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Have <code>createTriggerMessage()</code> return the created <code>FlowDropSessionMessageInterface</code> entity (instead of <code>void</code>)</li> <li>Call <code>$this-&gt;sessionService-&gt;processMessage($message)</code> directly in <code>executeImmediate()</code> after creating the trigger message</li> <li>Check session status after processing: <code>idle</code> = success, <code>failed</code> = failure, <code>awaiting_input</code> = fall through to polling for human-in-loop<br> flows</li> <li>Keep <code>waitForCompletion()</code> as a fallback if message creation fails</li> </ul> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p> Review and merge.</p> <h3 id="summary-ui-changes">User interface changes</h3> <p> None.</p> <h3 id="summary-api-changes">API changes</h3> <p> <code>WorkflowExecutionService::createTriggerMessage()</code> return type changes from <code>void</code> to <code>?FlowDropSessionMessageInterface</code>. This is a<br> <code>protected</code> method so it only affects subclasses.</p> <h3 id="summary-data-model-changes">Data model changes</h3>
issue