Skip to content

feat: Modularity change#1068

Draft
Dhruvkumar1-Microsoft wants to merge 189 commits into
mainfrom
dev
Draft

feat: Modularity change#1068
Dhruvkumar1-Microsoft wants to merge 189 commits into
mainfrom
dev

Conversation

@Dhruvkumar1-Microsoft

Copy link
Copy Markdown

Purpose

  • ...

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

marktayl1 and others added 30 commits April 23, 2026 16:16
- Fix 6 test collection errors caused by sys.modules pollution
- Remove dead code: agents_service.py, global_debug.py, requirements.txt
- Fix test imports to prevent module cache conflicts
- Add ADR-001: retain custom JSON declarative config over MAF declarative package

Test results: 880 passed, 0 collection errors, 13 pre-existing failures
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
- Remove azurite DB files from tracking, add __azurite_db_* to .gitignore
- Remove orphan root package-lock.json (no root package.json)
- Remove infra/old/ (24 superseded Bicep/ARM files)
- Remove src/frontend/migration-commands.txt (one-time Vite migration notes)
- Remove src/mcp_server/README_NEW.md (identical to README.md)
- Rename src/tests/agents/__init__py -> __init__.py (fix missing dot)
- Move test_sample_user.py (6 passing tests) to src/tests/backend/auth/
- Remove 13 old files: 5 duplicated in newer tree, 3 broken (stale imports),
  1 empty, 4 __init__.py
- Remove pycache-only dirs: handlers/, helpers/, context/
- Canonical test tree is now src/tests/ exclusively
- Remove duplicate AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME (keep gpt-4.1-mini)
- Remove 2 unused vars: AZURE_OPENAI_MODEL_NAME, AZURE_AI_MODEL_DEPLOYMENT_NAME
- Add 4 missing vars: AZURE_AI_PROJECT_ENDPOINT, AZURE_BASIC_LOGGING_LEVEL,
  AZURE_PACKAGE_LOGGING_LEVEL, AZURE_LOGGING_PACKAGES
- Group vars logically by service area
- Delete untracked .env_azure and .env_docker (hardcoded resource names)
- Remove src/.dockerignore (no effect; builds from src/backend/ and src/frontend/)
- Remove infra/main.json (compiled ARM artifact from main.bicep)
- Rename infra/vscode_web/.env -> .env.template (EJS placeholders, not values)
- Create root pyproject.toml with [tool.pytest.ini_options] and [tool.coverage.*]
- Add pythonpath = ['src'] to replace sys.path.insert hack in conftest.py
- Remove stale src/backend/tests/* omit pattern (dir deleted in prior commit)
- Delete pytest.ini and .coveragerc (now redundant)
- 886 tests pass, same 13 pre-existing failures (no regressions)
- Add thread-isolated integration tests for FoundryAgentTemplate covering
  MCP, RAG search, code interpreter, and multi-capability scenarios
- Fix singleton event-loop issue via _reset_cached_clients() helper
- Fix load_dotenv override to handle stale Windows user-level env vars
- Fix test_event_utils: mock config directly instead of env var check
- Fix test_health_check: use patch.object instead of string-based patching
Reasoning models (gpt-5*, o1, o3, o4) reject the temperature parameter with a 400 error. Passing temperature=None is also rejected because it serializes as null. Build a kwargs dict and spread into ChatAgent so temperature is fully omitted for these models, while gpt-4* models still get temperature=0.1.
Adds two new model deployments to the AI Foundry account: gpt-5-mini (reasoning + image-capable chat) and gpt-image-1 (image generation, required for ImageAgent in Use Case 6 / Ad Copy / Content Gen). New parameters: gpt5MiniModelName/Version/DeploymentType/Capacity and gptImageModelName/Version/DeploymentType/Capacity. Wired into both the existing-Foundry and new-Foundry deployment paths.
…ent-fixes

Feature/tas27 gpt5mini imageagent fixes
Co-authored-by: Copilot <copilot@github.com>
Task 1+2: Replace print() with structured logging; remove logging.basicConfig
- cosmosdb.py, router.py, team_utils.py: all print() -> logger.*
- team_utils.py: logging.basicConfig() -> logger = logging.getLogger(__name__)

Task 3: Remove stale commented-out imports
- magentic_agent_factory.py, lifecycle.py, response_handlers.py,
  settings.py, foundry_service.py, team_utils.py

Task 4: Rename common/models/messages_af.py -> messages.py
- Update all 29 import sites across src/backend and src/tests

Task 5: Rename utils_af.py -> team_utils.py, utils_agents.py -> agent_utils.py
- Update all import sites; rename matching test files

Task 8: Remove emoji from logger calls
- app.py, agent_registry.py, settings.py, router.py, magentic_agent_factory.py
- Fix matching test assertion in test_agent_registry.py
Migrate v4/magentic_agents to a new top-level agents/ package targeting the
GA agent_framework 1.2.2 + agent_framework_foundry 1.2.2 SDK.

New production modules:
- agents/agent_factory.py   – AgentFactory replaces MagenticAgentFactory
- agents/agent_template.py  – AgentTemplate replaces FoundryAgentTemplate
- agents/proxy_agent.py     – ProxyAgent ported to GA BaseAgent/AgentSession API
- agents/image_agent.py     – image agent carry-forward
- config/mcp_config.py      – MCPConfig / SearchConfig dataclasses
- config/agent_registry.py  – agent registry helper
- config/azure_config.py    – Azure config helpers
- orchestration/connection_config.py – connection/orchestration config

Key SDK changes from v4:
- MagneticOneGroupChat removed; orchestration handled by caller
- AgentThread -> AgentSession, ChatMessage -> Message
- TextContent/UsageContent -> Content.from_text/from_usage
- run_stream() -> run(stream=True) via ResponseStream
- FoundryAgentTemplate open() inlines _collect_tools and azure-search paths
- Reasoning + Bing guard-rail removed (platform constraint no longer applies)

New tests (69 passing, 0 failing):
- tests/backend/agents/test_agent_factory.py  (30 tests)
- tests/backend/agents/test_agent_template.py (15 tests)
- tests/backend/agents/test_proxy_agent.py    (24 tests)
- Remove InvalidConfigurationError from agent_factory.py (class, docstring,
  raise, and except clause) — platform constraint no longer applies
- Delete test_agent_factory.py tests for reasoning+bing/coding_tools guard-rail
- Delete test_sample_user.py — tested static fixture constants, not behavior
- Remove TestDatabaseBaseAbstractClass, TestDatabaseBaseMethodSignatures, and
  TestDatabaseBaseInheritance from test_database_base.py — tested Python's
  ABC machinery, not app logic

Net: 381 to 355 tests (-26)
- Add src/backend/models/__init__.py and plan_models.py (Phase 4.1 early,
  required by orchestration layer): PlanStatus, MStep, MPlan, AgentDefinition,
  PlannerResponseStep, PlannerResponsePlan
- Add src/backend/orchestration/human_approval_manager.py with plan_to_obj method
  and full exception handling in _wait_for_user_approval
- Add src/backend/orchestration/orchestration_manager.py
- Add src/backend/orchestration/helper/plan_to_mplan_converter.py
- Port 3 orchestration test suites (88 tests, all passing)
- Remove unnecessary parent sys.modules mocks from agent tests that caused
  full-suite collection contamination (test_proxy_agent, test_agent_factory,
  test_agent_template)
… kwargs assertion

- test_orchestration_manager.py: change unconditional sys.modules['agents'] = Mock()
  to setdefault so the real test package is not replaced during collection;
  this prevented pytest's Package.setup() from calling consider_module() on a Mock,
  which raised UsageError on pytest_plugins for all 73 agents/* setup steps
- test_app_config.py: add connection_timeout=30, read_timeout=180, retry_total=5
  to assert_called_once_with in test_get_ai_project_client_success; production code
  now passes these timeout kwargs to AIProjectClient

All 666 backend unit tests now pass (0 errors, 0 failures).
…p import errors

- Replace ChatMessage/AgentRunResponseUpdate/internal _magentic imports with
  MAF 1.2.2 GA types: Message, AgentResponseUpdate, AgentResponse, WorkflowEvent
- Rewrite orchestration_manager.py: MagenticBuilder keyword-args constructor,
  Agent() wrapper for FoundryChatClient, workflow.run(stream=True) event loop
  with WorkflowEvent type discriminator (magentic_orchestrator / data / output)
- Fix human_approval_manager.py: import MagenticContext/StandardMagenticManager
  from agent_framework.orchestrations; ORCHESTRATOR_* from agent_framework_orchestrations
- Fix callbacks/response_handlers.py: use Message and AgentResponseUpdate
- Add AgentMessageResponse and WebsocketMessageType to models/messages.py
- Remove stale executor state-clearing block (obsolete internal MAF 1.x API)
- Remove v4 router include from app.py and v4 import from team_utils.py
- Enable intermediate_outputs on MagenticBuilder for per-agent events
- Inject agent name markdown headers on executor_invoked events
- Stream all AgentResponseUpdate chunks to thinking buffer
- Use executor_completed for clean final results (agents + orchestrator)
- Fix PlanPage streaming handler to safely access content and scroll
- Fix vite.config.ts leaking full process.env into build
- Prior: AzureAISearchTool serialization, query_type default, SDK 2.1.0
- Only show agent name header when agent actually produces streaming output
- Remove robot emoji from agent headers
- Add search tool usage instructions to RFP team agent system messages
- Accumulate orchestrator streaming chunks as final result fallback
- Display agent names with 'Agent' suffix in plan steps (StreamingPlanResponse)
- Add agent names to Plan Overview left pane (PlanPanelRight)
- Strengthen plan prompt to require agent names on every step
- Remove party emoji prefix from final result message
- Revert basic logging level default back to WARNING
…proxy

MCP server and proxy are working well in the HR onboarding scenario.
The full workflow now completes end-to-end: pre-orchestration clarification,
HR agent tasks, and Tech Support agent tasks all execute as expected.

Fixes:
- hr.json: Add COMPLETION RULE to HR agent system message so it no longer
  declares the entire onboarding complete — only its own HR portion.
  Previously the orchestrator interpreted HR's closing language as workflow
  completion and never invoked TechnicalSupportAgent.
- plan_review_helpers.py: Add progress-ledger guard instructing the
  orchestrator to ignore agent-level completion language when deciding
  whether all plan steps are done.
- orchestration_manager.py: Add explicit MCP cleanup in a finally block
  at the end of run_orchestration to close UserInteractionAgent's
  streamable-HTTP async generators, preventing noisy cross-task
  RuntimeError from anyio on GC.

Validated: HR scenario runs to completion with both HR and Tech Support
agents invoked. MCP ask_user clarification round-trip works reliably
(an intermittent hang on the WebSocket/async-event chain was observed
once but resolved on retry — timing issue, not a logic bug).
Roopan-Microsoft and others added 24 commits June 19, 2026 12:36
fix: Fix model version in document (Copilot comment fix)
feat: ui/ux changes for feature branch
fix: resolved the team switching issue it is taking the caching RFP team for the first time
feat: merge UI/UX changes from psl feature branch into mark branch
fix: updated the latest and dev tags and updated the workflows
feat: Modularity and Infra standardization code changes
fix: Disable Delete button for Content Gen Team
fix: remove unnecessary scrollToBottom call in usePlanWebSocket
…wer and also fixed the Image is not getting rendered in WAF deployment
fix: Resolve the fix for intermittent issue image not showing in final answer and also fixed the Image is not getting rendered in WAF deployment
fix: Code fix to handle replan request
Comment thread test_mcp_tools.py

if not sid:
print("No session ID, aborting")
exit(1)
Comment thread src/backend/api/router.py
prior_task.cancel()
# Give the cancelled task a chance to clean up
await asyncio.sleep(0)
except Exception:
AI_SERVICES_ENDPOINT = os.environ.get("AZURE_OPENAI_ENDPOINT", "").rstrip("/")

if not SEARCH_ENDPOINT:
print("ERROR: AZURE_AI_SEARCH_ENDPOINT must be set.")
- The caller needs "Search Service Contributor" role on the search service.
"""

import json
import logging
import sys
from types import SimpleNamespace
from unittest.mock import AsyncMock, Mock, patch
from pathlib import Path

import pytest
import pytest_asyncio
sys.modules['common.models'] = Mock()
sys.modules['common.models.messages'] = Mock()

import pytest
Comment on lines +34 to +35
from backend.common.models.messages import (CurrentTeamAgent, DataType,
TeamConfiguration)
del sys.modules[_ma_key]

# Mock external dependencies that may not be installed in test environment
from fastapi import APIRouter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.