Skip to content

Prevent workflow env value update for agent kind#894

Merged
hanzjk merged 1 commit into
wso2:mainfrom
hanzjk:release
May 16, 2026
Merged

Prevent workflow env value update for agent kind#894
hanzjk merged 1 commit into
wso2:mainfrom
hanzjk:release

Conversation

@hanzjk
Copy link
Copy Markdown
Contributor

@hanzjk hanzjk commented May 16, 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.

When redeploying the agent (created from kind), it tries to update the env variables in the workflow. But workflows aren't available for this agent type.

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

  • Bug Fixes
    • Enhanced error handling in component deployment updates to properly capture API failure responses.
    • Improved handling of components without configured workflows to prevent configuration issues.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

📝 Walkthrough

Walkthrough

This PR adds error handling for non-200 OK API responses and implements an early-return pattern in workflow environment variable replacement when no workflow is configured. Both changes occur in the OpenChoreo component client.

Changes

Component Deployment Configuration

Layer / File(s) Summary
Component deployment error handling and workflow configuration
agent-manager-service/clients/openchoreosvc/client/components.go
UpdateComponentDeploymentConfig now maps JSON400 errors from the API response when component updates fail. replaceComponentWorkflowEnvVars returns early if component.Spec.Workflow is nil, avoiding unnecessary workflow config updates for kind-sourced agents where env vars are set directly on the Workload CR.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • RAVEENSR

Poem

A rabbit hops through config gates,
Adding errors, checking states,
When workflows rest in absent dreams,
Early returns flow like streams,
Deployment fix complete and bright! 🐰✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description is largely incomplete with only the Purpose section minimally filled; most required sections lack concrete details or are left as template placeholders. Complete the PR description by filling in Goals, Approach, Release note, Documentation, and other sections with specific implementation details, testing coverage, and security verification.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preventing workflow environment variable updates for agent kind components, which aligns with the code changes that add early return logic in replaceComponentWorkflowEnvVars.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agent-manager-service/clients/openchoreosvc/client/components.go`:
- Line 1312: The UpdateComponentWithResponse calls are inconsistent:
UpdateComponentDeploymentConfig was updated to propagate updateResp.JSON400 into
the returned UpdateComponentResp but the other update wrappers (the functions
that call UpdateComponentWithResponse such as the other Update... methods
referencing UpdateComponentWithResponse and returning UpdateComponentResp) still
omit JSON400; update those functions to include JSON400: updateResp.JSON400 in
their returned UpdateComponentResp so all update operations consistently surface
HTTP 400 validation details from the generated client (reference symbols:
UpdateComponentWithResponse, UpdateComponentResp, JSON400,
UpdateComponentDeploymentConfig).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b4f5c2cc-ad38-4a13-a02b-48f55398f728

📥 Commits

Reviewing files that changed from the base of the PR and between 92efe95 and dd7ebc7.

📒 Files selected for processing (1)
  • agent-manager-service/clients/openchoreosvc/client/components.go

Comment thread agent-manager-service/clients/openchoreosvc/client/components.go
@hanzjk hanzjk merged commit d6e14f5 into wso2:main May 16, 2026
7 checks passed
RAVEENSR pushed a commit to RAVEENSR/agent-manager that referenced this pull request May 27, 2026
Prevent workflow env value update for agent kind
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.

2 participants