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
<bash_terminal> <parameter=command> find /kestra -type f -name "*.java" | xargs grep -l "TriggerSchedulerMonitor" 2>/dev/null | head -20 </tool_call>
Assistant
The user wants me to fix an issue where
TriggerSchedulerMonitorreports realtime triggers as locked. Let me first explore the repository structure and find the relevant code.Assistant
Good, I found the relevant file. Let me open it to understand the issue.
Assistant
Let me use the correct syntax to open the file.
Assistant
Now I understand the issue. The
TriggerSchedulerMonitorreports triggers as "locked" when no execution is found. However, for realtime triggers (like Kafka), there's no execution - they're always waiting for events. Let me explore more to understand how to identify realtime triggers.Assistant
Let me look at the TriggerState model to understand its structure.
Assistant
I can see that
TriggerStatehas atypefield of typeTriggerType. Let me look at that enum.Assistant
Good, I found the file. Let me look at it to understand the TriggerType enum.
Assistant
Now I understand the issue. The
TriggerSchedulerMonitorreports triggers as "locked" when no execution is found. However, forREALTIMEtriggers (like Kafka), there won't be an execution until an external event arrives, so they will always be reported as "blocked" indefinitely.Let me look at the
TriggerSchedulerMonitormore closely to confirm my understanding.Assistant
Now I understand the issue. The
TriggerSchedulerMonitorreports all triggers as "locked" when no execution is found. However, for realtime triggers (like Kafka), there won't be an execution until an external event arrives, so they will always be reported as "blocked" indefinitely.The fix should skip the warning for realtime triggers since they don't create executions until an external event arrives.
Assistant
Now I understand the issue clearly. The
TriggerSchedulerMonitorreports triggers as "locked" when no execution is found. However, for realtime triggers (like Kafka), there won't be an execution until an external event arrives, so they will always be reported as "blocked" indefinitely.The fix should skip the warning and execution missing duration metric for realtime triggers. Let me implement this fix.
Assistant
Let me use a different approach without Python.
Assistant
Let me use sed to make the necessary changes to the file.
Assistant
Good, now let me modify the logic to skip realtime triggers.
Assistant
Good, the import was added. Now I need to modify the logic to skip realtime triggers when checking for missing executions. Let me use the edit command.
Assistant
Let me use a different approach with bash to write the file:
Assistant
Let me verify the file was written correctly.
Assistant
The file has been updated correctly. Now let me verify the changes and check if there are any existing tests.
Assistant
No existing tests for TriggerSchedulerMonitor. Let me check if there are any related scheduler tests that might be affected.
Assistant
Let me look at the scheduler tests to understand how the codebase is tested.
Assistant
Let me now verify the build works and run any existing tests.
Assistant
The user wants me to verify the build works and run any existing tests. Let me check the build system and try to compile the code.
Assistant
Let me explore the build system and try to compile the code.
Assistant
Let me compile the code to verify the fix is syntactically correct.
Assistant
The build was successful. Let me now run the existing scheduler tests to make sure the changes don't break anything.
Assistant
All 75 scheduler tests passed. Let me verify the git diff to see what changes were made.
Assistant
The git diff shows the changes I made:
- Added import for
TriggerType - Added a condition
state.getType() != TriggerType.REALTIMEto skip:- Recording the
METRIC_SCHEDULER_EXECUTION_MISSING_DURATIONtimer - Logging the "No execution found, schedule is blocked since" warning
- Recording the
This fixes the issue where realtime triggers (like Kafka) were incorrectly reported as "locked" when no execution was found, since realtime triggers don't create executions until an external event arrives.
Let me verify the fix is complete by checking the final state of the file:
- Added import for
Assistant
The fix is complete. Let me provide a summary of the reasoning and checklist:
Summary of Changes
File Modified:
scheduler/src/main/java/io/kestra/scheduler/TriggerSchedulerMonitor.javaChanges Made:
- Added import for
io.kestra.core.scheduler.model.TriggerType - Added a condition to skip the "No execution found, schedule is blocked" warning and the
METRIC_SCHEDULER_EXECUTION_MISSING_DURATIONmetric recording for realtime triggers
Reasoning:
- Realtime triggers (like Kafka) don't create executions until an external event arrives
- The monitor was incorrectly reporting realtime triggers as "locked/blocked" since they never have an execution
- Added import for
Assistant
The user wants me to submit the changes since the fix is complete. Let me call the submit command.
Assistant
The diff looks correct. The changes are:
- Added import for
TriggerType - Added a condition to skip the warning and metric for realtime triggers
The fix is complete. Let me submit it now.
- Added import for
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.