Fix race condition in MLflow integration causing red team runs to stuck in starting state #44376
+33
−17
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.
Description
Red team runs were getting stuck in "starting" state due to a race condition in the MLflow integration. The
update_red_team_runcall would fail when executed immediately aftercreate_evaluation_result, as the evaluation result hadn't fully propagated in the backend yet.Changes
Added retry logic with exponential backoff to both API calls in
_mlflow_integration.py:RetryManagerinMLflowIntegration.__init__()to handle transient failurescreate_evaluation_resultcall with retry decorator (5 attempts, 2-30s exponential backoff)update_red_team_runcall with retry decorator to handle race conditionThe exponential backoff naturally resolves the race condition by providing progressive delays (2s, 3s, 4.5s, 6.75s, 10s) for backend propagation. Uses existing
RetryManagerinfrastructure already employed throughout the red teaming codebase.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
pypi.org/home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python3 python3 -m pip install black --quiet(dns block)scanning-api.github.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.