fix: address Copilot PR review comments (high & medium priority)#256
Closed
Ashwal-Microsoft wants to merge 12 commits into
Closed
fix: address Copilot PR review comments (high & medium priority)#256Ashwal-Microsoft wants to merge 12 commits into
Ashwal-Microsoft wants to merge 12 commits into
Conversation
- Return base agent name instead of version-scoped ID in create_or_update_prompt_agent - Use global regex replace for comma removal in price parsing (textParsers.ts) - Fix logger name from 'agent_framework_foundry' to 'agent_framework.foundry' - Add defensive parsing for E2E_WARMUP_MS env var - Replace empty except with logged debug message in test_byocc.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses prior review feedback by tightening up parsing logic, improving test resiliency/diagnostics, and aligning logging/agent-script behavior with how the system is expected to run (Foundry agents by base name, correct logger namespace for suppression).
Changes:
- Make numeric/price parsing robust to multiple thousands separators by replacing all commas before
parseFloat. - Improve E2E test robustness: defensively parse
E2E_WARMUP_MSand log exceptions during fallback click attempts. - Fix Foundry logger suppression to target
agent_framework.foundry, and simplify agent creation script return values to the base agent name.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/e2e-test/tests/test_byocc.py | Adds defensive env var parsing and improves logging around fallback click behavior in E2E tests. |
| src/App/src/lib/textParsers.ts | Uses global comma removal to correctly parse prices/numbers with multiple separators. |
| src/api/app/main.py | Updates the suppressed logger name to the correct Foundry logger namespace. |
| infra/scripts/agent_scripts/01_create_agents.py | Returns the base agent name after version creation (rather than a version-scoped result name). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fi | ||
|
|
||
| # Trim whitespace from environment variables to avoid issues with leading/trailing spaces | ||
| SUBSCRIPTION_ID=$(trim "${AZURE_SUBSCRIPTION_ID}") |
Comment on lines
+894
to
+916
| scriptContent: ''' | ||
| param([string]$resourceGroupName, [string]$accountName) | ||
| $maxRetries = 60 | ||
| $retryCount = 0 | ||
| do { | ||
| try { | ||
| $account = Get-AzCognitiveServicesAccount -ResourceGroupName $resourceGroupName -Name $accountName -ErrorAction SilentlyContinue | ||
| if ($account -and $account.ProvisioningState -eq 'Succeeded') { | ||
| Write-Output "AI Services provisioning completed with state: $($account.ProvisioningState)" | ||
| break | ||
| } | ||
| } catch { | ||
| Write-Output "Error checking provisioning state: $_" | ||
| } | ||
| $retryCount++ | ||
| if ($retryCount -ge $maxRetries) { | ||
| Write-Output "Warning: AI Services did not reach terminal state within expected time, proceeding anyway (attempt $retryCount/$maxRetries)" | ||
| break | ||
| } | ||
| Write-Output "Waiting for AI Services provisioning... (attempt $retryCount/$maxRetries)" | ||
| Start-Sleep -Seconds 5 | ||
| } while ($true) | ||
| ''' |
Comment on lines
+889
to
+891
| identity: { | ||
| type: 'SystemAssigned' | ||
| } |
Comment on lines
+547
to
+548
| echo "AZURE_ENV_GPT_MODEL_CAPACITY=${AVAILABLE_CAPACITY:-10}" >> $GITHUB_ENV | ||
| echo "AZURE_ENV_GPT_MODEL_CAPACITY=${AVAILABLE_CAPACITY:-10}" >> $GITHUB_OUTPUT |
Comment on lines
+85
to
+86
| CURRENT_VALUE=$(az cognitiveservices usage list --location "$REGION" --query "[?name.value=='$MODEL'].currentValue | [0]" -o tsv 2>/dev/null) | ||
| LIMIT=$(az cognitiveservices usage list --location "$REGION" --query "[?name.value=='$MODEL'].limit | [0]" -o tsv 2>/dev/null) |
Comment on lines
+900
to
+903
| properties: { | ||
| azPowerShellVersion: '12.0' | ||
| scriptContent: ''' | ||
| param([string]$resourceGroupName, [string]$accountName) |
Comment on lines
+908
to
+912
| $account = Get-AzCognitiveServicesAccount -ResourceGroupName $resourceGroupName -Name $accountName -ErrorAction SilentlyContinue | ||
| if ($account -and $account.ProvisioningState -eq 'Succeeded') { | ||
| Write-Output "AI Services provisioning completed with state: $($account.ProvisioningState)" | ||
| break | ||
| } |
Comment on lines
+523
to
+524
| echo "AZURE_ENV_GPT_MODEL_CAPACITY=${AVAILABLE_CAPACITY:-10}" >> $GITHUB_ENV | ||
| echo "AZURE_ENV_GPT_MODEL_CAPACITY=${AVAILABLE_CAPACITY:-10}" >> $GITHUB_OUTPUT |
Comment on lines
123
to
126
| echo " - $MODEL: ${MIN_CAPACITY[$MODEL]}" | ||
| done | ||
| echo "QUOTA_FAILED=true" >> "$GITHUB_ENV" | ||
| exit 0 |
Comment on lines
+554
to
+556
| echo "🔍 Checking subscription-wide $SEARCH_TIER tier Azure Search service count..." | ||
| TOTAL_SERVICES=$(az search service list --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} \ | ||
| --query "[?sku.name=='${SEARCH_TIER}'] | length(@)" -o tsv 2>/dev/null || echo "0") |
Comment on lines
+558
to
+561
| # Subscription limits: basic=12, standard=12 (typical defaults) | ||
| # Use 12 as safe upper bound for both tiers | ||
| SUBSCRIPTION_LIMIT=12 | ||
| REMAINING=$((SUBSCRIPTION_LIMIT - TOTAL_SERVICES)) |
| ], | ||
| "webServerFarmResourceName": "[format('asp-{0}', variables('solutionSuffix'))]", | ||
| "reactAppLayoutConfig": "{\n \"appConfig\": {\n \"CHAT_CHATHISTORY\": {\n \"CHAT\": 70,\n \"CHATHISTORY\": 30\n }\n }\n }\n}", | ||
| "reactAppLayoutConfig": "{\r\n \"appConfig\": {\r\n \"CHAT_CHATHISTORY\": {\r\n \"CHAT\": 70,\r\n \"CHATHISTORY\": 30\r\n }\r\n }\r\n }\r\n}", |
Contributor
Author
|
Working on a different issue now, dev to main was resolved earlier |
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 includes several improvements across the codebase, focusing on robust data parsing, better error handling, and enhanced logging. The most significant changes are grouped below:
Data Parsing Consistency and Robustness:
src/App/src/lib/textParsers.tsto replace all commas (not just the first) before parsing, ensuring correct handling of numbers with thousands separators. This affects theparseOrderItem,parsePrice, andparseProductSectionfunctions. [1] [2] [3]Error Handling Improvements:
test_28907_golden_path_demo_script, improved handling of theE2E_WARMUP_MSenvironment variable by adding a try/except block to default to 5000ms and log a warning if the value is invalid.test_28935_new_session_clears_previous_data, added logging for exceptions during fallback force-click attempts, aiding debugging when the "New Session" button is not clickable.Logging Configuration:
src/api/app/main.pyto use the correct logger name (agent_framework.foundry) for error suppression.API Consistency:
infra/scripts/agent_scripts/01_create_agents.py, updatedcreate_or_update_prompt_agentto return the agent name directly instead of the result's name, simplifying the return value.- Return base agent name instead of version-scoped ID in create_or_update_prompt_agentPurpose
Does this introduce a breaking change?
What to Check
Verify that the following are valid
Other Information