Skip to content

Delete workflow run with monitor deletion and fix parameter schema of monitor workflow#651

Merged
menakaj merged 2 commits intowso2:mainfrom
hanzjk:cloud-rewrite
Apr 2, 2026
Merged

Delete workflow run with monitor deletion and fix parameter schema of monitor workflow#651
menakaj merged 2 commits intowso2:mainfrom
hanzjk:cloud-rewrite

Conversation

@hanzjk
Copy link
Copy Markdown
Contributor

@hanzjk hanzjk commented Apr 2, 2026

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

Resolves #504

Note:
Open-Choreo (v1.0.0) currently does not have an API to delete workflow runs. As a workaround will use the put endpoint to update the TTL values of the workflow run to 5s. So it would be deleted after 5 seconds of the delete monitor action.

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter �N/A� plus brief explanation of why there�s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type �Sent� when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type �N/A� and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added workflow run expiration functionality to enable automatic resource cleanup and lifecycle management of workflow runs across the system.
  • Chores

    • Enhanced workflow template schema by implementing OpenAPI V3 specification with improved field validation, explicit type definitions, required field enforcement, and support for configurable default values throughout the workflow templates.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 797ce00a-364d-4332-8078-db90daf7d765

📥 Commits

Reviewing files that changed from the base of the PR and between 2c11cab and d29163d.

📒 Files selected for processing (5)
  • agent-manager-service/clients/clientmocks/openchoreo_client_fake.go
  • agent-manager-service/clients/openchoreosvc/client/client.go
  • agent-manager-service/clients/openchoreosvc/client/generic-workflows.go
  • agent-manager-service/services/monitor_manager.go
  • deployments/helm-charts/wso2-amp-evaluation-extension/templates/workflow-templates/workflow-monitor-evaluation.yaml

📝 Walkthrough

Walkthrough

Added ExpireWorkflowRun method to OpenChoreo client interface and implementations to actively cleanup workflow runs. Modified monitor manager to invoke this method when deleting monitors. Updated workflow template schema from custom parameters to OpenAPI v3 format with explicit required fields and defaults.

Changes

Cohort / File(s) Summary
OpenChoreo Client Infrastructure
agent-manager-service/clients/clientmocks/openchoreo_client_fake.go, agent-manager-service/clients/openchoreosvc/client/client.go, agent-manager-service/clients/openchoreosvc/client/generic-workflows.go
Added ExpireWorkflowRun method to mock, interface, and client implementation. The implementation retrieves workflow run, sets TTL to 5s, and updates it, with HTTP status code validation and error handling (401/403/404/500).
Service Integration
agent-manager-service/services/monitor_manager.go
Modified DeleteMonitor to actively call ExpireWorkflowRun on OpenChoreo runs after database deletion, replacing placeholder cleanup logging with actual external resource cleanup.
Workflow Template Schema
deployments/helm-charts/wso2-amp-evaluation-extension/templates/workflow-templates/workflow-monitor-evaluation.yaml
Updated schema from custom parameters structure to openAPIV3Schema with explicit required fields (monitor, agent, environment, evaluation, publishing), nested requirements, and field defaults.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop-skip to cleanup, no orphans remain,
Expire those runs at the end of their reign,
Mock, interface, implementation align,
New schemas gleam in OpenAPI shine! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description provides the issue reference and explains the core solution, but most template sections (Goals, Approach, User stories, Release note, etc.) are left as unfilled template placeholders. Complete at least the Goals and Approach sections to explain the implementation details and rationale for the TTL-based workaround approach.
Out of Scope Changes check ❓ Inconclusive The parameter schema update to workflow-monitor-evaluation.yaml is a tangential change that, while related to monitor workflows, is not directly required by issue #504. Clarify whether the schema fix is a separate, coordinated change or should be addressed in a separate PR to keep scope focused.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes both main changes: implementing workflow run expiration on monitor deletion and fixing the parameter schema for the monitor workflow template.
Linked Issues check ✅ Passed The PR implements the ExpireWorkflowRun functionality to address issue #504, ensuring workflow runs are expired when monitors are deleted by setting TTL to 5 seconds.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@menakaj menakaj merged commit e551328 into wso2:main Apr 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeleteMonitor leaves openchoreo external WorkflowRuns orphaned.

2 participants