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 relevant code related to the
TriggerSchedulerMonitorissue.Assistant
I'll start by exploring the repository structure and finding the relevant code related to the
TriggerSchedulerMonitorissue.Assistant
Now let me understand the
TriggerStatemodel to see what fields are available, especially around trigger type (realtime vs non-realtime).Assistant
I can see there's a
TriggerTypefield. Let me look at theTriggerTypeenum to understand the different types.Assistant
Now I understand the issue. Realtime triggers are always locked (they continuously listen for events like Kafka messages), but they may not have executions. The monitor reports them as "blocked" incorrectly. Let me look at how
findTriggersEligibleForSchedulingworks to understand the context better.Assistant
Now I understand the issue. Realtime triggers are expected to be locked (listening for events) without executions. The monitor should skip realtime triggers. Let me look at how realtime triggers are handled in the scheduler to confirm.
Assistant
Now I have a clear understanding. Realtime triggers are always locked when they're being processed (sent to a worker to listen for events), but they may not have executions. The monitor incorrectly reports them as "blocked". The fix is to skip realtime triggers in the monitor.
Let me check the
getType()method is available onTriggerState:Assistant
Good. The
TriggerStatehas atypefield with@Getter, sogetType()is available. Now let me modify theTriggerSchedulerMonitorto filter out realtime triggers:Assistant
Now I'll modify the monitor to filter out realtime triggers. I'll add a filter after retrieving the triggers:
Assistant
Now let me add the filter for realtime triggers in the
run()method:Assistant
Now let me check if there are existing tests for
TriggerSchedulerMonitor:Assistant
No existing tests for the monitor. Let me verify the build compiles:
Assistant
The build compiles successfully. Now let me check if there are existing scheduler tests that might be affected and run them:
Assistant
Let me check if
getType()could return null (edge case) - looking at thefrommethod inTriggerType, it can returnnull. My filterstate.getType() != TriggerType.REALTIMEhandles null correctly (null != REALTIME is true, so null-type triggers would still be monitored). That's the correct behavior since we only want to skip realtime triggers.Let me also verify the
InMemoryTriggerStateStoreto make sure the test infrastructure supports this:Assistant
Let me run the existing scheduler tests to make sure I didn't break anything:
Assistant
All 75 tests pass. Let me also write a quick temporary test to verify the fix works correctly, then remove it before submitting:
Assistant
Let me create a temporary test to verify the fix:
Assistant
The test passes. Now let me remove the temporary test file before submitting:
Assistant
Let me verify the final state of the changes:
Assistant
The changes look clean. Let me also confirm no leftover test files:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.