Cannot add a comment to a process instance from within a process task (works via REST extension)

Hello Bonita Community,

I’m trying to add a comment to a process instance programmatically. When I use a custom REST API extension, it works perfectly.
However, when I try to do the same from within a process task (e.g. using a script task), it doesn’t work — no exception is thrown, but no comment appears either.

Here’s what I’m trying to do:

def processAPI = apiClient.getProcessAPI()
processAPI.addComment(processInstanceId, “This is a test comment from within a process”)

  • processInstanceId is valid (I’ve logged it and verified).
  • The same exact logic works when called via a REST API extension.
  • When it’s called from inside the process (e.g. a script task), the comment never shows up.

What I’ve tried:

  • Verified the processInstanceId is correct.
  • Tested the same code in REST context (success).
  • No exception or log error from Bonita when it fails inside the process.

My suspicion:

Is there some context limitation or permission restriction when calling addComment() from inside a process execution?