Skip to content

FOUR-33545 | Multi Transcript >> Remove Message Error in List Transcript - #9089

Open
mcraeteisha wants to merge 1 commit into
developfrom
defect/FOUR-33545
Open

mcraeteisha wants to merge 1 commit into
developfrom
defect/FOUR-33545

Conversation

@mcraeteisha

@mcraeteisha mcraeteisha commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Issue

Ticket: FOUR-33545

Rollback on a request in ERROR returns 500 from POST /api/1.0/tasks/{task}/rollback. The log is Call to a member function getEngine() on null in WorkflowManagerDefault::canRunInlineTask(). After a refresh, Rollback is gone and the request cannot be recovered from the summary.

Rollback copies the previous closed service task with replicate(), saves it as ACTIVE, then calls WorkflowManager::runServiceTask() with that Eloquent token. canRunInlineTask() does $token->getInstance()->getEngine(). A token loaded from the database has no Nayra execution instance, so getInstance() is null. The call throws before the request is set back to ACTIVE and before the failing task is closed. The new active token is already saved, so getErrorTask() no longer sees a FAILING token and the summary hides Rollback.

Solution

  • In ProcessMaker/Nayra/Managers/WorkflowManagerDefault.php, read the engine with $instance?->getEngine(). When the instance or engine is missing, canRunInlineTask() returns false and runServiceTask() / runScripTask() queue the task.
  • Tokens that already have an engine keep the existing inline-execution checks.
  • In tests/unit/ProcessMaker/RollbackProcessRequestTest.php, testServiceTaskWithoutEngineIsQueued asserts that a service token with no engine dispatches RunServiceTask. The script and service rollback mocks now compare element_id with === instead of assigning it.

How To Test

  1. As the process manager, open a request in ERROR whose latest token is FAILING and whose previous closed element is a service task. The PDF Generator -> Send Email process is enough: complete the form so the gateway takes the Send Email path, and let Send Email fail.
  2. Open /requests/{id} and choose Rollback.
  3. Confirm POST /api/1.0/tasks/{task}/rollback returns 200, the request is ACTIVE, and the summary still offers recovery if a later step fails.
  4. Run php vendor/bin/phpunit tests/unit/ProcessMaker/RollbackProcessRequestTest.php and confirm all four tests pass.

ci:deploy

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

Persisted tokens created during rollback may not have a live engine attached. This change prevents inline service-task execution when no engine is available and instead queues the job. It also adds a regression test covering service tasks without an engine and fixes a couple of assertion comparisons in the rollback tests.
@cursor

cursor Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes when script/service tasks run inline vs queued; rollback and ERROR recovery paths are affected, but behavior for tokens with an active engine should stay the same.

Overview
Fixes rollback on ERROR requests failing with a 500 when the rolled-back service/script task is restarted: canRunInlineTask() no longer calls getEngine() on a null instance.

WorkflowManagerDefault now uses null-safe $instance?->getEngine() and treats a missing engine as “not inline,” so persisted tokens (e.g. replicated during rollback) queue RunServiceTask / RunScriptTask instead of crashing. Live tokens with an engine keep the same inline-execution rules.

Tests: adds testServiceTaskWithoutEngineIsQueued (asserts RunServiceTask is dispatched) and fixes rollback mock assertions to use === for element_id.

Reviewed by Cursor Bugbot for commit 50ced22. Bugbot is set up for automated code reviews on this repo. Configure here.

@mcraeteisha
mcraeteisha requested a review from eiresendez October 6, 2026 16:11
@decisions-sonarqube

Copy link
Copy Markdown

@vladyrichter

Copy link
Copy Markdown

QA server K8S was successfully deployed https://tenant-1.ci-021bf76669.engk8s.processmaker.net

@eiresendez eiresendez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is narrowly scoped and appears correct 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants