Skip to content

azure-ai-agents LRO poller util fix for custom end states#48157

Open
jpalvarezl wants to merge 4 commits intomainfrom
jpalvarezl/fix/memory_store_tests
Open

azure-ai-agents LRO poller util fix for custom end states#48157
jpalvarezl wants to merge 4 commits intomainfrom
jpalvarezl/fix/memory_store_tests

Conversation

@jpalvarezl
Copy link
Member

This pull request introduces a new internal utility class to centralize and standardize polling behavior for Memory Stores long-running operations (LROs) in the Azure AI Agents SDK. It ensures that required headers are consistently injected and custom terminal states are correctly mapped, while also simplifying and improving the test code for reliability and maintainability.

Key changes:

Polling infrastructure improvements

  • Added a new package-private utility class AgentsServicePollUtils that injects the required Foundry-Features HTTP header into polling requests and remaps custom LRO terminal states ("completed", "superseded") to standard LongRunningOperationStatus values. This ensures consistent behavior across all polling strategies.
  • Updated OperationLocationPollingStrategy and SyncOperationLocationPollingStrategy to delegate header injection and status remapping to AgentsServicePollUtils, reducing code duplication and improving maintainability. [1] [2] [3] [4]

Testing enhancements

  • Added a new test class AgentsServicePollUtilsTest to verify correct header injection and status remapping logic, including edge cases for custom and standard statuses.
  • Refactored MemoryStoresAsyncTests and MemoryStoresTests to remove custom status handling in favor of standard .isComplete() checks and added timeouts to prevent hanging tests, improving test reliability and clarity. [1] [2] [3] [4] [5] [6] [7] [8]

Asset tracking

  • Updated the assets manifest to reference the new build/tag for the Java SDK.

Copilot AI review requested due to automatic review settings February 27, 2026 13:34
Copy link
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

This PR fixes Azure AI Agents Memory Stores long-running operation (LRO) polling by centralizing two behaviors: injecting the required Foundry-Features header on polling requests and remapping custom terminal states (e.g., "completed", "superseded") to standard LongRunningOperationStatus values so pollers complete correctly.

Changes:

  • Added internal AgentsServicePollUtils to inject Foundry-Features via polling context and remap custom LRO end states.
  • Updated async and sync Operation-Location polling strategies to use the shared utility (reduced duplication).
  • Refactored Memory Stores tests to use standard completion checks and added a dedicated unit test for the new utility.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsServicePollUtils.java New internal helper for polling header injection and custom-status remapping.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/OperationLocationPollingStrategy.java Delegates polling status remap + header injection to the shared utility.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/SyncOperationLocationPollingStrategy.java Sync equivalent delegation to the shared utility.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/implementation/AgentsServicePollUtilsTest.java New unit tests covering remapping and context header injection.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/MemoryStoresTests.java Refactors sync Memory Stores LRO waiting logic and adds timeouts.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/MemoryStoresAsyncTests.java Refactors async Memory Stores LRO waiting logic and adds timeouts.
sdk/ai/azure-ai-agents/assets.json Updates assets tag reference.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants