[backend] feat(chaining): add timeout logic to chaining simulations (#4824)#5625
[backend] feat(chaining): add timeout logic to chaining simulations (#4824)#5625impolitepanda wants to merge 2 commits intorelease/currentfrom
Conversation
2c83661 to
f462179
Compare
There was a problem hiding this comment.
Pull request overview
Adds timeout enforcement for chaining workflow runs by periodically detecting expired RUN workflows, force-ending the workflow + active steps, and purging delay-queue entries to prevent late/straggling step execution.
Changes:
- Added repository query + service methods to identify expired workflow runs and mark them END.
- Added Quartz job + trigger (behind
InjectChainingCondition) to force-complete expired runs on a schedule. - Added step-level guards and comprehensive unit/integration test coverage around timeout completion.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| openaev-model/src/main/java/io/openaev/database/repository/WorkflowRepository.java | Adds native query to find expired RUN workflows and an existsByIdAndStatus helper. |
| openaev-model/src/main/java/io/openaev/database/repository/StepDelayQueueRepository.java | Adds derived delete method for purging delay-queue entries by workflow run. |
| openaev-api/src/main/java/io/openaev/service/chaining/WorkflowTimeoutService.java | New service orchestrating force-completion (end steps, purge delay queue, end workflow). |
| openaev-api/src/main/java/io/openaev/service/chaining/WorkflowService.java | Adds timeout-related service methods (ended check, expired workflows query, end workflow). |
| openaev-api/src/main/java/io/openaev/service/chaining/StepService.java | Adds guards to ignore step execution/updates after workflow timeout; adds bulk “end active steps” helper. |
| openaev-api/src/main/java/io/openaev/service/chaining/StepDelayQueueService.java | Adds transactional method to purge delay-queue entries for a workflow run. |
| openaev-api/src/main/java/io/openaev/scheduler/jobs/WorkflowTimeoutJob.java | New Quartz job to periodically force-complete expired workflow runs. |
| openaev-api/src/main/java/io/openaev/scheduler/PlatformTriggers.java | Registers a scheduled trigger for the timeout job (conditional on chaining being enabled). |
| openaev-api/src/main/java/io/openaev/scheduler/PlatformJobDefinitions.java | Registers a Quartz JobDetail for the timeout job. |
| openaev-api/src/test/java/io/openaev/service/chaining/WorkflowTimeoutServiceTest.java | Unit tests for timeout service orchestration and delegation. |
| openaev-api/src/test/java/io/openaev/service/chaining/WorkflowTimeoutIntegrationTest.java | Integration tests covering DB effects: ending workflows/steps and purging delay-queue entries; validates expiry query. |
| openaev-api/src/test/java/io/openaev/service/chaining/StepServiceTimeoutGuardsTest.java | Unit tests for step execution/update guards after workflow END. |
| openaev-api/src/test/java/io/openaev/scheduler/jobs/WorkflowTimeoutJobTest.java | Unit tests for job execution behavior and error isolation per workflow. |
| openaev-api/src/test/java/io/openaev/service/chaining/WorkflowServiceTest.java | Import tidy-up. |
| .github/instructions/backend.instructions.md | Documents repository-encapsulation rule (expose cross-service access via owning service). |
f462179 to
cbe71a6
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/current #5625 +/- ##
=====================================================
+ Coverage 63.99% 64.06% +0.07%
- Complexity 5912 5934 +22
=====================================================
Files 1151 1154 +3
Lines 34582 34651 +69
Branches 2663 2668 +5
=====================================================
+ Hits 22130 22200 +70
+ Misses 11153 11152 -1
Partials 1299 1299 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@impolitepanda the migration numbering has changed to 5_XX, so you might want to check this before a full review |
Don't know how I missed that, will correct ! thanks |
Proposed changes
Testing Instructions
Related issues
Checklist