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
TriggerSchedulerMonitoris reporting realtime triggers as locked, but realtime triggers will always be "blocked" without any executionId, so they shouldn't be reported as locked.Let me first explore the repository structure to understand the codebase.
Assistant
There's a single file called
TriggerSchedulerMonitor.java. Let me look at it.Assistant
Now I understand the issue. The code checks if an execution was found for a trigger state. If no execution is found, it logs a warning. But for realtime triggers (like the kafka trigger mentioned in the issue), there will never be an execution because they are continuously triggered. So the condition
execution.isEmpty()is true for realtime triggers, and they get reported as "blocked".Let me look at the TriggerState model to understand what properties it has, particularly to see if there's something that identifies it as a realtime trigger.
Assistant
Let me look at the TriggerState model to understand its properties.
Assistant
I see the
TriggerStatehas atypefield of typeTriggerType. Let me look at whatTriggerTypecontains.Assistant
Let me read the TriggerType class to understand what types of triggers exist.
Assistant
Now I understand the structure. The
TriggerTypehas three values:SCHEDULE,POLLING, andREALTIME. Realtime triggers don't create executions in the same way - they continuously process events.Let me also look at the
RealtimeTriggerInterfaceto confirm:Assistant
Now I understand the issue clearly. Let me look at the test file for the monitor to understand how it's tested:
Assistant
Now I have a clear understanding of the issue. Let me also check if there are existing tests for the scheduler monitor:
Assistant
Now I have a clear understanding of the issue. Let me analyze the problem:
TriggerSchedulerMonitorfinds triggers that are "locked" (waiting for execution)- For each locked trigger, it checks if an execution exists
- If no execution exists, it logs a warning: "No execution found, schedule is blocked since..."
- Realtime triggers (like Kafka) continuously process events and don't create traditional executions
- So realtime triggers will always have no execution found, causing constant warnings
The fix should skip the "no execution found" warning for realtime triggers. The
TriggerStatehas atypefield of typeTriggerTypewhich can beSCHEDULE,POLLING, orREALTIME.Let me implement the fix:
Assistant
Now I understand the issue completely. The
TriggerSchedulerMonitorchecks if an execution exists for each locked trigger. For realtime triggers (like Kafka), there won't be any traditional execution since they continuously process events. This causes the warning "No execution found, schedule is blocked since..." to be logged indefinitely for realtime triggers.The fix should skip the "no execution found" warning for realtime triggers. Let me check the
TriggerTypeimport situation:Assistant
Now I'll implement the fix. The issue is that realtime triggers will never have an execution (they continuously process events), so they shouldn't be reported as "blocked". The fix needs to skip the warning for realtime triggers.
Assistant
Let me use the edit command directly instead:
Assistant
Let me add the import for
TriggerTypefirst:Assistant
Now I need to add the check for REALTIME triggers. Let me see the current state of the file to find the right line to add the fix.
Assistant
Now I need to add the check for REALTIME triggers. I'll add it right after the execution lookup, before the isEmpty check:
Assistant
Let me see the lines around line 64 to understand the context better:
Assistant
Now I'll add the check for REALTIME triggers. I need to add it right after the execution lookup and before the isEmpty check. The REALTIME triggers will never have an execution, so we should skip them entirely.
Assistant
Let me use the proper edit command:
Assistant
I need to use the edit command properly. Let me check the current line numbers again.
Assistant
Now I can see the line numbers clearly. I need to add the check after line 64 and before line 65.
Assistant
Let me try using bash to perform the edit using sed instead.
Assistant
Let me check the result of the sed command to see if it worked correctly.
Assistant
The file has been modified correctly. The changes look good:
- Added the import for
TriggerTypeon line 18 - Added the check for
TriggerType.REALTIMEon lines 65-68, which returns early (skips monitoring) for realtime triggers
Now let me verify the code compiles correctly by checking if there's a build system we can use:
- Added the import for
Assistant
I see there's a
.gradledirectory, so this is a Gradle project. Let me try to compile the changed file to verify the fix:Assistant
Let me verify the fix compiles correctly:
Assistant
The build was successful. Now let me run the existing tests for the scheduler module to make sure everything still works:
Assistant
All 75 scheduler tests pass. Let me verify the final diff of my changes:
Assistant
The fix has been successfully applied and verified. Let me summarize what was done:
Summary
Issue
The
TriggerSchedulerMonitorwas reporting realtime triggers as locked with messages like:"No execution found, schedule is blocked since '...'"
This was incorrect because realtime triggers (like Kafka triggers) continuously process events and don't create traditional executions, so they would always be flagged as "blocked" indefinitely.
Root Cause
The monitor checks if an execution exists for each locked trigger. If no execution is found, it logs a warning. For realtime triggers, this check always fails because they don't create traditional executions - they process events in real-time.
Solution
Added an early return for realtime triggers in
TriggerSchedulerMonitor.java:- Added import for
TriggerType - Added a check that skips monitoring (returns early) when
state.getType() == TriggerType.REALTIME
This prevents realtime triggers from being checked for traditional executions and avoids the false "blocked" warnings.
Verification
- Added import for
Assistant
The user wants me to submit my changes. Let me use the correct format for the submit command.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.