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
Let me start by understanding the issue. The
TriggerSchedulerMonitorreports realtime triggers as locked, but these triggers will always be blocked without any executionID, so they will be reported indefinitely. This is a false positive warning.Let me first explore the repository structure to understand how it's organized and find the relevant code.
Assistant
Let me look at this file to understand the issue.
<tool_call> <function=bash_terminal> <parameter=command> cat /kestra/scheduler/src/main/java/io/kestra/scheduler/TriggerSchedulerMonitor.java </tool_call> <tool_call> <function=bash_terminal> <parameter=command> find /kestra -type f -name "*.java" | xargs grep -l "schedule is blocked" 2>/dev/null | head -20 </tool_call>
Assistant
Let me explore the repository structure and understand the TriggerSchedulerMonitor code:
Assistant
Now let me understand what a "realtime" trigger is and how it differs from locked triggers:
Assistant
Let me understand the TriggerService to understand how realtime triggers are identified:
Assistant
Let me look at the TriggerType to understand realtime triggers and also the TriggerState model:
Assistant
Now I understand the issue. Let me look at the TriggerState model to understand its structure and see what fields are available.
Assistant
Let me check the TriggerState model to understand its structure.
Assistant
Let me look at how the trigger state store and the scheduler handle realtime triggers:
Assistant
Let me check how
findTriggersEligibleForSchedulinghandles realtime triggers and look at the implementation:Assistant
Let me look at the DefaultSchedulableTriggerFetcher to understand how realtime triggers are handled.
Assistant
Now let me understand the issue more clearly. The
TriggerSchedulerMonitoris looking for locked triggers that don't have an execution. But realtime triggers are designed to be "blocked" or continuously running without an execution ID.Let me look at the
CachedTriggerStateStoreto see how it filters triggers:Assistant
Now I need to understand the issue better. The
TriggerSchedulerMonitoris checking locked triggers and reporting them as "blocked" when there's no execution found. But realtime triggers are designed to not have an execution ID, so they'll always be "blocked" without an execution.Looking at the code:
- In
TriggerSchedulerMonitor.run(), it finds all locked triggers - For each trigger, it checks if there's an execution associated with it
- If no execution is found, it logs a warning that the schedule is blocked
The issue is that realtime triggers (which implement
RealtimeTriggerInterface) are designed to run continuously and may not have an execution ID. They're "locked" but don't need an execution.Let me look at how realtime triggers are handled in the TriggerScheduler to understand the flow better.
- In
Assistant
Now I understand the issue. Let me look at the
TriggerTypeand how triggers are classified:Assistant
Now I fully understand the issue. Let me summarize:
- The
TriggerSchedulerMonitorchecks locked triggers and logs a warning when no execution is found for them. - Realtime triggers (implementing
RealtimeTriggerInterface) are designed to be locked without having an execution ID - they continuously listen for events. - The
TriggerScheduler.processWorkerTrigger()method explicitly sets realtime triggers as locked (mustBeLocked = trigger instanceof RealtimeTriggerInterface). - Since realtime triggers will always be locked without an execution, they'll continuously trigger the "schedule is blocked" warning.
The fix: In
TriggerSchedulerMonitor, skip the "no execution found, schedule is blocked" warning for realtime triggers since this is their expected behavior.Let me verify the TriggerState has a
getType()method that returnsTriggerType:- The
Assistant
Now I understand the issue. Let me check the existing tests and then implement the fix:
Assistant
Now let me implement the fix. The issue is that
TriggerSchedulerMonitorwarns about triggers being "blocked" when no execution is found, but realtime triggers are designed to always be locked without an execution ID.Let me make the fix:
Assistant
Now I understand the issue. The
TriggerSchedulerMonitorlogs a warning when a locked trigger has no execution, but realtime triggers are designed to be locked without an execution ID. They continuously listen for events and don't create executions in the traditional sense.The fix is to skip the warning for realtime triggers since this is their expected behavior. I'll add a check for
TriggerType.REALTIMEbefore logging the warning.Assistant
Let me edit the file to add the import and fix the logic.
Assistant
Let me check the current file content and the edit format I should use.
Assistant
Let me edit the file to add the import for TriggerType and modify the logic to skip realtime triggers.
Assistant
Let me check the current state of the file to understand the line numbers for the edit.
Assistant
Now I need to modify the logic to skip the warning for realtime triggers. The key change is on lines 73-79, adding a check for
TriggerType.REALTIME.Assistant
Let me verify the change was applied correctly.
Assistant
The fix looks correct. Now let me verify by checking if there are any existing tests related to
TriggerSchedulerMonitorand run them to ensure my change doesn't break anything.Assistant
The command exited with a non-zero exit code. Let me try a different approach to find tests related to TriggerSchedulerMonitor.
Assistant
There are no existing tests for
TriggerSchedulerMonitor. Let me check if the project builds correctly with this change.Assistant
This is a Gradle project. Let me compile the changed file to verify the fix compiles correctly.
Assistant
The compilation succeeded with only warnings (not related to my changes). Let me run the scheduler tests to make sure my fix doesn't break anything.
Assistant
Let me check if the tests passed:
Assistant
All tests passed. Let me verify the final diff of my changes:
Assistant
The changes look good. Let me verify everything is working by running the full build for the scheduler module:
Assistant
The build is successful. My fix is complete.
Summary of Changes
The issue was that
TriggerSchedulerMonitorwas reporting realtime triggers as "blocked" because it couldn't find an associated execution. However, realtime triggers (implementingRealtimeTriggerInterface) are designed to be continuously locked without having an execution ID - they continuously listen for events.Fix Applied:
File:
scheduler/src/main/java/io/kestra/scheduler/TriggerSchedulerMonitor.java-
Added import for
TriggerType:import io.kestra.core.scheduler.model.TriggerType; -
Modified the warning condition to skip realtime triggers:
// Before: if (state.getUpdatedAt() == null || state.getUpdatedAt().plusSeconds(60).isBefore(Instant.now())) { // After: if (state.getType() != TriggerType.REALTIME && (state.getUpdatedAt() == null || state.getUpdatedAt().plusSeconds(60).isBefore(Instant.now()))) {
This change ensures that:
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.