fix: Dev v4 to main PR#1001
Open
Dhruvkumar-Microsoft wants to merge 23 commits into
Open
Conversation
fix: Dev v4 to dependabotchanges downmerge
fix: Add toaster message of failure in logs
chore: main to dev downmerge
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
refactor: Updated Foundry Roles name
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request aligns Azure AI Foundry RBAC terminology by renaming the “Azure AI User” role to “Foundry User” across docs/infra/scripts, and improves plan-execution failure reporting end-to-end (backend orchestration → WebSocket → frontend UI state).
Changes:
- Rename “Azure AI User” → “Foundry User” in documentation, Bicep templates, ARM template output, and the role-assignment script.
- Backend: propagate orchestration failures with richer logging/telemetry and emit
ERROR_MESSAGEWebSocket events; attempt to mark the plan as failed in storage. - Frontend: add a centralized
planFailedFinalRedux action and handleERROR_MESSAGE(plus a safety net for error-as-final-result), improving UX for failure states; minor UI tweak for “AI Agent” tag display.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/backend/v4/orchestration/test_orchestration_manager.py | Extends mocks to cover new imports/message types used by orchestration error handling. |
| src/backend/v4/orchestration/orchestration_manager.py | Adds plan_id threading, DB status update on failure, and sends ERROR_MESSAGE via WebSocket. |
| src/backend/v4/api/router.py | Wraps background orchestration task with error logging + telemetry (plan/session/user context). |
| src/App/src/store/slices/planSlice.ts | Adds planFailedFinal action to centralize plan failure UI state updates. |
| src/App/src/hooks/usePlanWebSocket.tsx | Handles ERROR_MESSAGE and updates plan/UI state accordingly; disconnects socket on terminal failure. |
| src/App/src/components/content/streaming/StreamingAgentMessage.tsx | Only shows “AI Agent” tag for non-system agent messages. |
| infra/scripts/assign_azure_ai_user_role.sh | Updates role-name output/messages to “Foundry User”. |
| infra/main.json | Regenerates ARM template (Bicep generator metadata and formatting changes). |
| infra/main.bicep | Updates inline role comment to “Foundry User”. |
| infra/main_custom.bicep | Updates inline role comment to “Foundry User”. |
| docs/re-use-foundry-project.md | Updates role assignment guidance to “Foundry User”. |
| docs/LocalDevelopmentSetup.md | Updates local dev role assignment command to “Foundry User”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+41
to
43
| from common.database.database_factory import DatabaseFactory | ||
| from v4.models.models import PlanStatus | ||
|
|
| "content": f"Error during orchestration: {str(e)}", | ||
| "content": user_error_message, | ||
| "status": "error", | ||
| "timestamp": asyncio.get_event_loop().time(), |
| echo "Assigning Azure AI User role role to users" | ||
| echo "Assigning Foundry User role to users" | ||
|
|
||
| echo "Using provided Azure AI resource id: $aif_resource_id" |
feat: Enhance email template, add RG owner tag, scalability input
fix: dependabot package upgrades
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 22 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (1)
src/App/src/hooks/usePlanWebSocket.tsx:260
- In the
ERROR_MESSAGEhandler you mark the plan failed and disconnect, but you don’t disable the chat input. If input was enabled (e.g., after a clarification request), the user can still submit text against a disconnected/failed run. DispatchsetSubmittingChatDisableInput(true)as part of this failure handling.
const errorAgent: AgentMessageData = {
agent: 'system',
agent_type: AgentMessageType.SYSTEM_AGENT,
timestamp: Date.now(),
steps: [],
next_steps: [],
content: formatErrorMessage(errorContent),
raw_data: errorMessage || '',
};
dispatch(addAgentMessage(errorAgent));
dispatch(planFailedFinal());
dispatch(setShowBufferingText(false));
scrollToBottom();
showToast(errorContent, 'error');
webSocketService.disconnect();
},
Comment on lines
+41
to
43
| from common.database.database_factory import DatabaseFactory | ||
| from v4.models.models import PlanStatus | ||
|
|
Comment on lines
+299
to
+303
| async def run_orchestration(self, user_id: str, input_task, plan_id: str = None) -> None: | ||
| """ | ||
| Execute the Magentic workflow for the provided user and task description. | ||
| """ | ||
| self._plan_id = plan_id |
| "content": f"Error during orchestration: {str(e)}", | ||
| "content": user_error_message, | ||
| "status": "error", | ||
| "timestamp": asyncio.get_event_loop().time(), |
Comment on lines
+202
to
220
| } else if (messageStatus === 'error') { | ||
| // Safety net: handle error status sent as FINAL_RESULT_MESSAGE | ||
| const errorContent = finalMessage.data?.content || 'An unexpected error occurred. Please try again later.'; | ||
| const errorAgent: AgentMessageData = { | ||
| agent: 'system', | ||
| agent_type: AgentMessageType.SYSTEM_AGENT, | ||
| timestamp: Date.now(), | ||
| steps: [], | ||
| next_steps: [], | ||
| content: formatErrorMessage(errorContent), | ||
| raw_data: finalMessage || '', | ||
| }; | ||
| dispatch(addAgentMessage(errorAgent)); | ||
| dispatch(planFailedFinal()); | ||
| dispatch(setShowBufferingText(false)); | ||
| scrollToBottom(); | ||
| showToast(errorContent, 'error'); | ||
| webSocketService.disconnect(); | ||
| } |
| echo "Assigning Azure AI User role role to users" | ||
| echo "Assigning Foundry User role to users" | ||
|
|
||
| echo "Using provided Azure AI resource id: $aif_resource_id" |
Comment on lines
+571
to
+582
| # Update plan status to failed in the database | ||
| try: | ||
| if self._plan_id: | ||
| memory_store = await DatabaseFactory.get_database(user_id=user_id) | ||
| plan = await memory_store.get_plan_by_plan_id(plan_id=self._plan_id) | ||
| if plan: | ||
| plan.overall_status = PlanStatus.FAILED | ||
| await memory_store.update_plan(plan) | ||
| self.logger.info("Plan '%s' status updated to FAILED", self._plan_id) | ||
| except Exception as db_error: | ||
| self.logger.error("Failed to update plan status to FAILED: %s", db_error) | ||
|
|
fix: address SFI security compliance issues
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.
Purpose
This pull request primarily updates the naming of a key Azure role from "Azure AI User" to "Foundry User" throughout the documentation, infrastructure, and scripts, to match current Azure terminology. Additionally, it introduces improved error handling and status reporting in the frontend and backend plan orchestration workflow.
Role Naming Consistency Updates:
docs/LocalDevelopmentSetup.md,docs/re-use-foundry-project.md), infrastructure Bicep modules (infra/main.bicep,infra/main_custom.bicep), deployment scripts (infra/scripts/assign_azure_ai_user_role.sh), and generated ARM templates (infra/main.json) have been changed to "Foundry User" for accuracy and clarity. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]Frontend Plan Orchestration Improvements:
planFailedFinalaction in the Redux slice to centralize error state management for plan execution. [1] [2]Backend Orchestration Robustness:
These changes ensure consistent terminology, improve user experience by making error states more visible and actionable, and enhance backend robustness for orchestration failures.
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information