Skip to content

Conversation

@gusys
Copy link
Contributor

@gusys gusys commented Dec 12, 2025

Issue & Reproduction Steps

Describe the issue this ticket solves and describe how to reproduce the issue (please attach any fixtures used to reproduce the issue).

Solution

  • List the changes you've introduced to solve the issue.

How to Test

Describe how to test that this solution works.

Related Tickets & Packages

  • Link to any related FOUR tickets, PRDs, or packages

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.

Note

Introduces a microservice-based path for custom script executors, gated by config('script-runner-microservice.enabled').

  • Service layer: New ScriptMicroserviceService handles Keycloak auth (cached), tenant ensure, executor CRUD (createCustomExecutor, updateCustomExecutor, deleteCustomExecutor), runner discovery, request dispatch, and instance_uuid generation.
  • API controllers: store/update/delete now conditionally call the service for microservice mode; fallback to existing events/jobs in non-microservice mode. Delete uses executor UUID for remote cleanup.
  • Runners: ScriptMicroserviceRunner now delegates token/requests to the service, resolves runner (built-in vs custom), and enriches metadata (executor_uuid, executor_type, instance_uuid). ScriptRunner routes to microservice runner when enabled.
  • Admin UI: Blade passes script_microservice_enabled and script_microservice_instance_uuid to Vue. Vue listens to Echo channel build-image-{instance_uuid} for build logs/events when microservice is enabled; retains legacy user channel otherwise.
  • Tests: Adds unit tests covering service behaviors (create/update with 404-create, delete, tenant auto-create, and access token caching).

Written by Cursor Bugbot for commit dc801e3. This will update automatically on new commits. Configure here.

@cursor
Copy link

cursor bot commented Dec 12, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on December 21.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Fix declare http client

Refactor how to get instance uuid

Remove instance uuid variable
@gusys gusys changed the title Add custom executor in microservices feature FOUR-28426: Add custom executor in microservices feature Dec 23, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

config('script-runner-microservice.base_url') . '/custom/' . $this->getInstanceUuid() . '/scripts';

if (!$custom && Cache::has('script-runner-microservice.script-runner')) {
return Cache::get('script-runner-microservice.script-runner.' . $language);
Copy link

Choose a reason for hiding this comment

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

Cache key mismatch causes cache to never hit

The cache key used in Cache::has() on line 111 is 'script-runner-microservice.script-runner' (without language suffix), but the key used in Cache::get() on line 112 and Cache::put() on line 127 includes the language suffix ('script-runner-microservice.script-runner.' . $language). This mismatch means the has check will never find the cached value, causing every call to getScriptRunner() for non-custom scripts to make an unnecessary HTTP request to the microservice instead of using the cached result.

Additional Locations (1)

Fix in Cursor Fix in Web

ScriptExecutorDeleted::dispatch($scriptExecutor->getAttributes());
} else {
$service->deleteCustomExecutor($scriptExecutorUUID);
}
Copy link

Choose a reason for hiding this comment

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

Delete order causes inconsistency if microservice call fails

The delete method destroys the local database record on line 266 before attempting to delete from the microservice on line 271. If deleteCustomExecutor() throws an exception (e.g., network error, microservice unavailable), the local record is already permanently deleted while the remote executor still exists. This creates a data inconsistency where the microservice has orphaned executors that can't be managed. The microservice deletion needs to happen before or atomically with the local database deletion.

Fix in Cursor Fix in Web

@processmaker-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

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