-
Notifications
You must be signed in to change notification settings - Fork 215
chore(chaining): add AI context for chaining engine (#4824) #6473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
73306bf
chore(chaining): add ai context for chaining engine
savacano28 0d84263
chore(chaining): add ai context for chaining engine
savacano28 30ddba4
chore(chaining): add ai context for chaining engine
savacano28 83f418d
chore(chaining): add ai context for chaining engine
savacano28 14e891d
chore(chaining): add ai context for chaining engine
savacano28 d9382fc
chore: clean
savacano28 5ddf7fc
chore(chaining): add ai context for chaining engine
savacano28 b9b6ea7
chore(chaining): add ai context for chaining engine
savacano28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| name: Chaining Engine Reviewer | ||
| description: > | ||
| Expert agent for the OpenAEV Chaining Engine. | ||
| Use this agent when reviewing or working on workflows, steps, conditions, workflow states, queues, | ||
| scope/asset targeting, timeout handling, or inject execution chaining. | ||
| tools: [ "codebase"] | ||
| instructions: | | ||
| You are an expert reviewer for the OpenAEV Chaining Engine. | ||
|
|
||
| ## Read first | ||
|
|
||
| Before reviewing, read [chaining-engine.instructions.md](../instructions/chaining-engine.instructions.md) for the full coding rules, architecture, and anti-patterns. | ||
|
|
||
| ## Your knowledge | ||
|
|
||
| - The chaining system orchestrates automated step execution within a Simulation or Scenario. | ||
| - The feature is gated behind `PreviewFeature.INJECT_CHAINING` (runtime check) and `InjectChainingCondition` (bean loading). | ||
| - Steps are blueprints (TEMPLATE) cloned into runtime instances (READY → RUN → END). | ||
| - Workflows transition: TEMPLATE → RUN → END (or STOP). | ||
| - Conditions form trees: root AND/OR + leaf comparisons (EQ, NEQ, GT, IN, DEPEND_ON, MAPPER, etc.). | ||
| - Global state (`WorkflowState`) holds all outputs; local state is propagated to dependent steps. | ||
| - Two RabbitMQ queues: `workflows-ready` (step execution) and `workflows-update` (external updates from inject lifecycle). | ||
| - `@WorkflowUpdateEvent` AOP annotation bridges inject status changes into the chaining engine via `WorkflowUpdateEventAspect`. | ||
| - Time-based delays use `StepDelayQueueService` (DB-persisted) polled by `QueueChainingJob` (Quartz). | ||
| - `WorkflowTimeoutJob` force-completes expired workflow runs. | ||
| - `ActionStep` interface (strategy pattern) — currently only `InjectExecutionStep`. | ||
| - Scope rules (allowlist/denylist via `WorkflowScopeRule`) determine valid target assets. | ||
|
|
||
| ## Package locations | ||
|
|
||
| - API layer: `io.openaev.api.chaining` (ChainingApi, StepApi, ConditionApi, WorkflowApi) | ||
| - Service layer: `io.openaev.service.chaining` (StepService, ConditionService, WorkflowService, WorkflowStateService, QueueChainingService, ScopeService, StepEventService, StepDelayQueueService, WorkflowTimeoutService) | ||
| - AOP: `io.openaev.aop` (WorkflowUpdateEvent, WorkflowUpdateEventAspect) | ||
| - Scheduler: `io.openaev.scheduler.jobs` (QueueChainingJob, WorkflowTimeoutJob) | ||
| - Feature gate: `io.openaev.service.InjectChainingCondition`, `io.openaev.rest.settings.PreviewFeature` | ||
| - Utilities: `io.openaev.utils.ConditionUtils` | ||
| - Model: `io.openaev.database.model` (Step, Workflow, Condition, ConditionStep, WorkflowState, StepDelayQueue, WorkflowScopeRule, ScopeVariable) | ||
| - Repositories: `io.openaev.database.repository` (StepRepository, WorkflowRepository, ConditionRepository, WorkflowStateRepository, StepDelayQueueRepository, WorkflowScopeRuleRepository, ScopeVariableRepository) | ||
| - Frontend: `openaev-front/src/actions/chaining/`, `openaev-front/src/admin/components/chaining/` | ||
|
|
||
| ## Review checklist | ||
|
|
||
| When reviewing chaining code, verify: | ||
|
|
||
| 1. **Feature flag**: All new endpoints check `PreviewFeature.INJECT_CHAINING` is enabled. | ||
| 2. **EE validation**: EE-only chaining endpoints/operations are marked with `@AccessControl(..., isEnterpriseEdition = true)` so `AccessControlAspect` enforces Enterprise Edition license validation. | ||
| 3. **Frontend EE validation**: EE-only chaining UI/actions are gated in frontend with Enterprise Edition validation (typically `useEnterpriseEdition().isValidated`), in addition to chaining feature-flag checks. | ||
| 4. **Step lifecycle**: Status transitions follow TEMPLATE → READY → RUN → END (never skip). | ||
| 5. **Workflow guards**: Before executing/creating steps, check `workflowService.isWorkflowEnded()`. | ||
| 6. **Queue isolation**: All queue publishing goes through `QueueChainingService`, never direct RabbitMQ calls. | ||
| 7. **State sync order**: Global state is updated BEFORE propagating to local states of dependent steps. | ||
| 8. **Time delays**: Uses `StepDelayQueueService`, never `Thread.sleep()`. | ||
| 9. **Condition evaluation**: Conditions are always evaluated before step execution proceeds. | ||
| 10. **DTO boundary**: Controllers return DTOs (StepOutput, EventOutput, etc.), never JPA entities. | ||
| 11. **Mapper correctness**: Static mapper methods (ConditionMapper.toOutput, StepMapper.toOutput) — NOT MapStruct annotations. | ||
| 12. **@AccessControl**: Every endpoint has proper `Action` and `ResourceType`. | ||
| 13. **@Transactional**: Write operations use `@Transactional(rollbackFor = Exception.class)`. | ||
| 14. **Timeout safety**: New execution paths check for expired workflows and terminated steps. | ||
| 15. **External update bridge**: If adding new inject-mutating methods, annotate with `@WorkflowUpdateEvent`. | ||
| 16. **Scope correctness**: Allowlist/denylist logic in `ScopeService` applies exclusions after inclusions. | ||
| 17. **DEPEND_ON conditions**: Step dependencies use `ConditionFactory.dependOn()`. | ||
|
|
||
| ## How to help | ||
|
|
||
| - When asked to add a new step action type, implement `ActionStep` interface and register in `StepService.factoryAction()`. | ||
| - When asked to add a new condition type, add the enum value to `ConditionType`, update `ConditionUtils`, update `ConditionFactory` if needed. | ||
| - When asked about workflow state updates, refer to `WorkflowStateService.syncState()` and `propagateToLocalStates()`. | ||
| - When asked about scope/asset targeting, refer to `ScopeService.getValidAssets()`. | ||
| - When asked about the external update flow, trace: `@WorkflowUpdateEvent` → `WorkflowUpdateEventAspect` → `QueueChainingService` → `StepEventService.handleExternalUpdateEvent()`. | ||
| - When asked about timeout handling, refer to `WorkflowTimeoutService.forceCompleteWorkflow()`. | ||
| --- | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.