We were struggling with a real p4 trigger not probing the jobs (while manual one worked perfectly fine).
It came out, that a job's build permission on anonymous user is not enough, as it's handler, P4Hook.doChange, when calls getJobs(), actually returns 0 jobs (tested with custom build of p4.hpi and additional logging). That was weird... but hinted me that maybe context of anonymous user have something to do with it, as manual trigger is able to successfully call getJobs() when user is fully authenticated. Adding Job Read permission on anonymous user at Matrix-based security fixed our issue.
I would like to ask adding additional permission check of type read around here:
... unless it should work as it is and issue is somewhere else.