ISSUE DESCRIPTION The TriggerSchedulerMonitor reports realtime triggers as locked…
- User
ISSUE DESCRIPTION
The
TriggerSchedulerMonitorreports realtime triggers as lockedDescribe the issue
The
TriggerSchedulerMonitorreports realtime triggers as locked.[tenant: main] [namespace: company.team] [flow: realtime-kafka] [trigger: kafka] No execution found, schedule is blocked since '2026-04-27T13:38:23.415498Z'
But as those trigger will always be blocked without any executionID they will be reported indefinitly.
Environment
- Kestra Version: develop
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /kestra, current file: none) bash-$
Assistant
I'll start by exploring the repository structure and finding the
TriggerSchedulerMonitorclass to understand the issue.Assistant
The error indicates I need to use a different syntax for the open command. Let me try without the file parameter.
Assistant
Now I understand the code. Let me explore more to understand how triggers are structured and how to identify "realtime" triggers.
Assistant
I can see that
TriggerStatehas atypefield of typeTriggerType. Let me check whatTriggerTypeis and if it can distinguish realtime triggers.Assistant
Now I understand the issue. The
TriggerSchedulerMonitoris monitoring all locked triggers, including realtime triggers. However, realtime triggers don't have executions in the traditional sense - they are event-driven and will always appear "blocked" without an executionID. The fix should skip realtime triggers in the monitor.Let me look at the issue more closely:
Assistant
Looking at the code logic:
- The
run()method retrieves all locked triggers (trueparameter means locked triggers) - For each trigger, it checks if there's an execution
- If no execution is found and it's been locked for more than 60 seconds, it logs a warning
The issue is that realtime triggers will never have an execution in the same way as scheduled triggers - they respond to events immediately. So they should be excluded from this monitoring.
Let me check if there are any tests for this monitor to understand expected behavior better:
- The
Assistant
Now let me understand the fix needed. The issue states that realtime triggers are always reported as locked because they will never have an execution ID. The solution is to skip realtime triggers in the
TriggerSchedulerMonitor.Let me check what the
typefield looks like and how to check for realtime triggers:Assistant
The
TriggerStateclass has atypefield and since it uses Lombok@Getter, there should be agetType()method. Now let me create a test script to confirm the issue and then apply the fix.Let me look at how other parts of the codebase check for realtime triggers:
Assistant
Let me look at how
TriggerEventHandlerhandles realtime triggers:Assistant
Now I understand the pattern. The fix should add a check in
TriggerSchedulerMonitorto skip realtime triggers since they won't have an execution ID in the same way. Let me modify the file:Assistant
Now I need to add the import for
TriggerTypeand add a check to skip realtime triggers. The fix should skip realtime triggers early in the loop since they will always appear blocked without an execution ID.Assistant
Good, the import is added. Now I need to add the check to skip realtime triggers inside the
forEachloop. The best place is right at the start of the lambda:Assistant
Now I need to add the check to skip realtime triggers. The fix should add a check at the beginning of the lambda to skip realtime triggers:
Assistant
I need to use a different approach since python3 is not available. Let me use sed to make the change.
Assistant
I notice there's a small indentation issue on line 64. The comment has extra spaces. Let me fix the indentation:
Assistant
The code looks good now. Let me verify the changes by checking the diff:
Assistant
Now let me try to build the project and run any existing tests to ensure the change is correct:
Assistant
Let me check if there are any tests for the TriggerSchedulerMonitor or related scheduler tests:
Assistant
Let me look for any tests that might be testing the monitor functionality:
Assistant
There are no existing tests for
TriggerSchedulerMonitor. Let me try to compile the project to make sure the changes are valid:Assistant
The build was successful. The compilation passed with only warnings (which are pre-existing and not related to my change). Let me also run the scheduler tests to make sure nothing is broken:
Assistant
All 75 scheduler tests passed. The change is valid and doesn't break any existing functionality.
Let me verify the final change one more time:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.