From b24ac6883f62b97fbf8e0c58401592f8e1aed158 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Mon, 27 Jul 2026 02:51:20 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20remove=20wrap=5Fplugin=5Froute=20?= =?UTF-8?q?=E2=80=94=20it=20broke=20ForwardRef=20resolution=20for=20body?= =?UTF-8?q?=20params?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wrap_plugin_route copied __signature__ from the original handler but the wrapper's __globals__ namespace (plugin_error_handler.py) did not contain the Pydantic models (ConversationCreate, MessageCreate, etc.). FastAPI could not resolve ForwardRef('ConversationCreate') → 422 on all POST routes with body parameters. Removing the wrapper entirely fixes this. Plugin error isolation can be re-added later using a different approach (middleware or exception handler). --- app/main.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/main.py b/app/main.py index d42268d..4397f80 100644 --- a/app/main.py +++ b/app/main.py @@ -435,17 +435,12 @@ def create_app() -> FastAPI: try: router_module = importlib.import_module(route_def.module) router = getattr(router_module, route_def.router_attr) - # Wrap each HTTP route handler with plugin error isolation - # and add active-plugin check per-route (not router-level) - # so WebSocket routes are NOT affected. + # Skip WebSocket routes — no wrapping, no plugin check from starlette.routing import WebSocketRoute - from fastapi import APIRouter as _AR plugin_dep = Depends(require_active_plugin(plugin_name)) for route in router.routes: if isinstance(route, WebSocketRoute): - continue # WebSocket: no wrap, no plugin check - if hasattr(route, 'endpoint'): - route.endpoint = wrap_plugin_route(route.endpoint) + continue # Add require_active_plugin to each HTTP route's dependencies if not hasattr(route, 'dependencies'): route.dependencies = []