azure-ai-agents LRO poller util fix for custom end states#48157
Open
jpalvarezl wants to merge 4 commits intomainfrom
Open
azure-ai-agents LRO poller util fix for custom end states#48157jpalvarezl wants to merge 4 commits intomainfrom
jpalvarezl wants to merge 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
AgentsServicePollUtilsto injectFoundry-Featuresvia 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. |
...azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsServicePollUtils.java
Outdated
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/MemoryStoresTests.java
Outdated
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/MemoryStoresTests.java
Outdated
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/MemoryStoresTests.java
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/MemoryStoresAsyncTests.java
Show resolved
Hide resolved
...azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsServicePollUtils.java
Show resolved
Hide resolved
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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
AgentsServicePollUtilsthat injects the requiredFoundry-FeaturesHTTP header into polling requests and remaps custom LRO terminal states ("completed", "superseded") to standardLongRunningOperationStatusvalues. This ensures consistent behavior across all polling strategies.OperationLocationPollingStrategyandSyncOperationLocationPollingStrategyto delegate header injection and status remapping toAgentsServicePollUtils, reducing code duplication and improving maintainability. [1] [2] [3] [4]Testing enhancements
AgentsServicePollUtilsTestto verify correct header injection and status remapping logic, including edge cases for custom and standard statuses.MemoryStoresAsyncTestsandMemoryStoresTeststo 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