Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions src/backend/v4/magentic_agents/common/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ async def open(self) -> "MCPEnabledBase":
# Register agent (best effort)
try:
agent_registry.register_agent(self)
except Exception:
pass
except Exception as ex:
self.logger.debug("Failed to register agent in registry: %s", ex)

return self

Expand All @@ -98,13 +98,13 @@ async def close(self) -> None:
if self._agent and hasattr(self._agent, "close"):
try:
await self._agent.close() # AzureAIAgentClient has async close
except Exception:
pass
except Exception as ex:
self.logger.debug("Failed to close agent: %s", ex)
# Unregister from registry if present
try:
agent_registry.unregister_agent(self)
except Exception:
pass
except Exception as ex:
self.logger.debug("Failed to unregister agent from registry: %s", ex)
await self._stack.aclose()
finally:
self._stack = None
Expand Down Expand Up @@ -309,27 +309,26 @@ async def close(self) -> None:
if self._agent and hasattr(self._agent, "close"):
try:
await self._agent.close()
except Exception:
pass
except Exception as ex:
self.logger.debug("Failed to close agent in AzureAgentBase: %s", ex)

# Unregister from registry
try:
agent_registry.unregister_agent(self)
except Exception:
pass
except Exception as ex:
self.logger.debug("Failed to unregister agent from registry: %s", ex)

# Close credential and project client
if self.client:
try:
await self.client.close()
except Exception:
pass
except Exception as ex:
self.logger.debug("Failed to close Azure AI client: %s", ex)
if self.creds:
try:
await self.creds.close()
except Exception:
pass

except Exception as ex:
self.logger.debug("Failed to close Azure credentials: %s", ex)
finally:
await super().close()
self.client = None
Expand Down
16 changes: 16 additions & 0 deletions src/frontend/frontend_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse, HTMLResponse
from fastapi.staticfiles import StaticFiles
from urllib.parse import urlparse

# Load environment variables from .env file
load_dotenv()
Expand Down Expand Up @@ -39,7 +40,22 @@ async def serve_index():
async def get_config():
backend_url = os.getenv("BACKEND_API_URL", "http://localhost:8000")
auth_enabled = os.getenv("AUTH_ENABLED", "false")

# Validate backend_url is a proper URL with scheme and netloc
try:
parsed = urlparse(backend_url)
if not (parsed.scheme in ["http", "https"] and parsed.netloc):
backend_url = "http://localhost:8000"
except Exception:
backend_url = "http://localhost:8000"

backend_url = backend_url + "/api"

# Validate auth_enabled is a boolean string
if auth_enabled and auth_enabled.lower() in ["true", "false"]:
auth_enabled = auth_enabled.lower()
else:
auth_enabled = "false"

config = {
"API_URL": backend_url,
Expand Down
25 changes: 1 addition & 24 deletions src/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/frontend/src/components/content/HomeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import "./../../styles/HomeInput.css";
import { HomeInputProps, iconMap, QuickTask } from "../../models/homeInput";
import { TaskService } from "../../services/TaskService";
import { NewTaskService } from "../../services/NewTaskService";
import { RAIErrorCard, RAIErrorData } from "../errors";

import ChatInput from "@/coral/modules/ChatInput";
import InlineToaster, { useInlineToaster } from "../toast/InlineToaster";
Expand Down Expand Up @@ -63,7 +62,6 @@ interface ExtendedQuickTask extends QuickTask {
const HomeInput: React.FC<HomeInputProps> = ({ selectedTeam }) => {
const [submitting, setSubmitting] = useState<boolean>(false);
const [input, setInput] = useState<string>("");
const [raiError, setRAIError] = useState<RAIErrorData | null>(null);

const textareaRef = useRef<HTMLTextAreaElement>(null);
const navigate = useNavigate();
Expand All @@ -79,7 +77,6 @@ const HomeInput: React.FC<HomeInputProps> = ({ selectedTeam }) => {

const resetTextarea = () => {
setInput("");
setRAIError(null); // Clear any RAI errors
if (textareaRef.current) {
textareaRef.current.style.height = "auto";
textareaRef.current.focus();
Expand All @@ -94,7 +91,6 @@ const HomeInput: React.FC<HomeInputProps> = ({ selectedTeam }) => {
const handleSubmit = async () => {
if (input.trim()) {
setSubmitting(true);
setRAIError(null); // Clear any previous RAI errors
let id = showToast("Creating a plan", "progress");

try {
Expand Down Expand Up @@ -140,7 +136,6 @@ const HomeInput: React.FC<HomeInputProps> = ({ selectedTeam }) => {

const handleQuickTaskClick = (task: ExtendedQuickTask) => {
setInput(task.fullDescription);
setRAIError(null); // Clear any RAI errors when selecting a quick task
if (textareaRef.current) {
textareaRef.current.focus();
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/agents/test_foundry_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Now import from the v4 package
from src.backend.v4.magentic_agents.foundry_agent import FoundryAgentTemplate
from src.backend.v4.magentic_agents.models.agent_models import (BingConfig, MCPConfig,
from src.backend.v4.magentic_agents.models.agent_models import (MCPConfig,
SearchConfig)


Expand Down
2 changes: 1 addition & 1 deletion src/tests/agents/test_human_approval_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
backend_path = Path(__file__).parent.parent.parent / "backend"
sys.path.insert(0, str(backend_path))

from af.models.models import MPlan, MStep
from af.models.models import MPlan
from af.orchestration.human_approval_manager import \
HumanApprovalMagenticManager

Expand Down
Loading