Skip to content

[backend] feat(chaining): add timeout logic to chaining simulations (#4824)#5625

Open
impolitepanda wants to merge 2 commits intorelease/currentfrom
issue/4824-add-timeout-logic
Open

[backend] feat(chaining): add timeout logic to chaining simulations (#4824)#5625
impolitepanda wants to merge 2 commits intorelease/currentfrom
issue/4824-add-timeout-logic

Conversation

@impolitepanda
Copy link
Copy Markdown
Member

Proposed changes

  • Add timeout logic to chaining simulations

Testing Instructions

  1. Create a simulation with a set timeout
  2. Run simulation with steps lasting longer than set timeout
  3. Check that steps and simulation are set to completed status when timeout is reached and that no other result is received after

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality
  • For bug fix -> I implemented a test that covers the bug

@github-actions github-actions Bot added the filigran team use to identify PR from the Filigran team label Apr 28, 2026
@impolitepanda impolitepanda force-pushed the issue/4824-add-timeout-logic branch from 2c83661 to f462179 Compare April 28, 2026 12:39
@impolitepanda impolitepanda requested a review from Copilot April 28, 2026 12:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread openaev-api/src/main/java/io/openaev/service/chaining/StepService.java Outdated
@impolitepanda impolitepanda force-pushed the issue/4824-add-timeout-logic branch from f462179 to cbe71a6 Compare April 29, 2026 09:01
@impolitepanda impolitepanda changed the title [backend] feat(chaining): add timeout logic to chaining simulations [backend] feat(chaining): add timeout logic to chaining simulations (#4824) Apr 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.06%. Comparing base (3f4a810) to head (cbe71a6).

Files with missing lines Patch % Lines
...in/java/io/openaev/scheduler/PlatformTriggers.java 0.00% 6 Missing ⚠️
.../java/io/openaev/service/chaining/StepService.java 96.00% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@antoinemzs
Copy link
Copy Markdown
Member

@impolitepanda the migration numbering has changed to 5_XX, so you might want to check this before a full review

@impolitepanda
Copy link
Copy Markdown
Member Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team use to identify PR from the Filigran team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants