Skip to content

[Agent] PlanExecuteReflect: Return memory early to track progress #3884

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pyek-bot
Copy link
Contributor

@pyek-bot pyek-bot commented May 31, 2025

Description

  • Returns executor_memory_id and executor_parent_interaction_id when available
  • Updates task state to running
  • Returns parent_interaction_id during task creation
  • Moved updateMLTask method to a utils function

Related Issues

Resolves #3881

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@pyek-bot pyek-bot requested a deployment to ml-commons-cicd-env-require-approval May 31, 2025 01:48 — with GitHub Actions Waiting
@pyek-bot pyek-bot requested a deployment to ml-commons-cicd-env-require-approval May 31, 2025 01:48 — with GitHub Actions Waiting
@pyek-bot pyek-bot requested a deployment to ml-commons-cicd-env-require-approval May 31, 2025 01:48 — with GitHub Actions Waiting
@pyek-bot pyek-bot requested a deployment to ml-commons-cicd-env-require-approval May 31, 2025 01:48 — with GitHub Actions Waiting
@@ -0,0 +1,59 @@
package org.opensearch.ml.common.utils;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add license header

@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 19:10 — with GitHub Actions Error
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 19:10 — with GitHub Actions Error
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 19:10 — with GitHub Actions Failure
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 19:10 — with GitHub Actions Failure
public static final ImmutableSet<MLTaskState> TASK_DONE_STATES = ImmutableSet
.of(MLTaskState.COMPLETED, MLTaskState.COMPLETED_WITH_ERROR, MLTaskState.FAILED, MLTaskState.CANCELLED);

public static void updateMLTaskDirectly(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this method here from MLAgentExecutor to facilitate reuse

@pyek-bot pyek-bot force-pushed the executor_memory_id_consistent_returns branch from a1de599 to bae6369 Compare June 3, 2025 19:37
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 19:38 — with GitHub Actions Error
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 19:38 — with GitHub Actions Failure
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 19:38 — with GitHub Actions Failure
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 19:38 — with GitHub Actions Error
}
} catch (Exception e) {
log.error("Failed to update ML task {}", taskId, e);
listener.onFailure(e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you also add the "Failed to update ML task {}", taskId in the onFailure message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

onFailure accepts an exception. So do you want me to wrap the thrown exception with the message:

listener.onFailure(new Exception(String.format("Failed to update ML Task: %s, taskId), e)));

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, use a new MLException please

public class MLException extends RuntimeException {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this 5XX or 4XX level error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This try-catch is redundant, I have removed it. The only try-catch now is try-with-resources for the ThreadContext and I guess this should be 4XX errors.

@mingshl
Copy link
Collaborator

mingshl commented Jun 3, 2025

please add UT to verify your change is expected

@dhrubo-os
Copy link
Collaborator

The current test failure is added in this PR: #3882

@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval June 3, 2025 21:18 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval June 3, 2025 21:18 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval June 3, 2025 21:18 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval June 3, 2025 21:18 — with GitHub Actions Waiting
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval June 3, 2025 22:01 — with GitHub Actions Inactive
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval June 3, 2025 22:01 — with GitHub Actions Inactive
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 22:01 — with GitHub Actions Failure
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 22:01 — with GitHub Actions Error
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 9.52381% with 38 lines in your changes missing coverage. Please review.

Project coverage is 78.79%. Comparing base (8fe39de) to head (5c647df).

Files with missing lines Patch % Lines
...va/org/opensearch/ml/common/utils/MLTaskUtils.java 0.00% 21 Missing ⚠️
...thms/agent/MLPlanExecuteAndReflectAgentRunner.java 0.00% 16 Missing ⚠️
...ch/ml/engine/algorithms/agent/MLAgentExecutor.java 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3884      +/-   ##
============================================
- Coverage     78.84%   78.79%   -0.05%     
  Complexity     7452     7452              
============================================
  Files           658      659       +1     
  Lines         33280    33299      +19     
  Branches       3750     3754       +4     
============================================
- Hits          26240    26239       -1     
- Misses         5393     5411      +18     
- Partials       1647     1649       +2     
Flag Coverage Δ
ml-commons 78.79% <9.52%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval June 3, 2025 23:03 — with GitHub Actions Failure
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval June 3, 2025 23:03 — with GitHub Actions Inactive
@dhrubo-os
Copy link
Collaborator

please add UT to verify your change is expected

+1

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.

[FEATURE] PlanExecuteReflect Agent: Return executor memory id when task is in progress or task fails
5 participants