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 locate the monitor implementation and its tests, then trace how realtime trigger state differs from scheduled trigger state so the exclusion is applied at the correct abstraction layer. After reproducing the problematic selection/reporting path, I’ll make the smallest targeted change and run the relevant test suite.
- Assistant
ripgrepis unavailable in this environment, so I’ll use recursivegrepwhile excluding generated directories to find the implementation and assertions. - Assistant
I found the report site. Next I’ll inspect the monitor, trigger model hierarchy, repository queries, and scheduler tests to identify whether realtime triggers can be filtered by type, marker interface, or execution ID without affecting ordinary schedules.
- Assistant
The monitor currently treats every locked
TriggerStateas execution-backed. The core model already has aTriggerType.REALTIMEdiscriminator, which is preferable to looking up plugin classes. I’ll inspect how that type and lock/execution fields are populated, and search for monitor tests in all modules (including JDBC integration tests). - Assistant
TriggerState.typeis persisted and explicitly set toREALTIME; realtime states are intentionally kept locked while their worker runs, unlike schedule/polling states whose lock corresponds to an execution. Therefore the defect can be reproduced directly from the code path: a locked realtime state is returned,findAllByTriggeris empty by design, and the monitor emits the missing-execution metric/warning forever. I’ll verify the lifecycle comments and store query behavior, then patch the monitor to exclude realtime states before repository lookup and monitoring. - Assistant
The lifecycle confirms realtime deletion kills a trigger worker rather than an execution, and legacy states may have a null type. I’ll filter only states explicitly marked
REALTIME(using null-safe enum equality), preserving monitoring for schedule, polling, and legacy/null-type states. Filtering before the empty check and loop also avoids unnecessary execution repository queries and metrics. - Assistant
Python is also unavailable, so no file was changed. I’ll apply the same focused edit with the repository’s non-interactive editor command, then inspect the diff.
- Assistant
The editor’s line-number replacement exposed a shifted-line mistake: it replaced
SchedulerClockrather than inserting afterTriggerState, then the second replacement duplicated the declaration. I’ve identified the exact malformed ranges and will correct both imports and method body before any compilation. - Assistant
The diff is now clean and exactly scoped to type-based exclusion. I’ll run the scheduler module’s compile/checkstyle-equivalent task first, then its existing unit tests. This validates Java compatibility, formatting conventions, and scheduler behavior without modifying or adding tests.
- Assistant
The first validation command did not execute compilation because Gradle rejects the task graph up front when any requested task is unknown (
pmdMainis not configured here). I’ll query available scheduler verification tasks, then run only valid targeted tasks. - Assistant
The relevant valid tasks are
:scheduler:compileJava,:scheduler:spotlessJavaCheck, and:scheduler:test. I’ll run compilation and formatting together first; if successful, I’ll run the scheduler tests separately so any failure source is clear. - Assistant
Compilation succeeded. The module-wide Spotless check failed only on pre-existing violations in other named files;
TriggerSchedulerMonitor.javawas not among them, so the changed file conforms. I’ll now run all existing scheduler tests. (I will not runspotlessApply, since that would alter unrelated source and tests.) - Assistant
All 75 scheduler tests pass, including realtime scheduling/lifecycle coverage. Final review shows the fix is limited to one production file and does not modify tests.
Checklist:
- Reported error reproduced: I traced the concrete monitor path with a locked
TriggerStateofTriggerType.REALTIME: realtime states remain locked for their worker lifecycle, have no execution ID/execution by design, and the previous unconditional repository lookup therefore reached the indefinite missing-execution metric/warning branch. - Fix confirmed: Explicit realtime states are filtered before execution lookup, metrics, and warning logging, so they can no longer produce the reported blocked-schedule warning. Schedule, polling, and legacy null-type states remain monitored.
- Edge cases considered: The comparison is null-safe (
TriggerType.REALTIME.equals(...)), the filtered list can be empty and follows the existing early-return path, and mixed lists still monitor all non-realtime states. - Affected tests run:
:scheduler:compileJavasucceeded and:scheduler:testpassed all 75 tests. The changed file passes Spotless formatting; module-widespotlessJavaCheckremains blocked by pre-existing violations in unrelated files, which I intentionally did not alter.
I’ll perform one final status/diff check and submit the change.
- Reported error reproduced: I traced the concrete monitor path with a locked
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →